Problem 2254. Possible Opponents Matrix for single-elimination tournament

It's tournament time!

Given a single-elimination tournament with 2^N competitors, compute the 2^N by 2^N matrix M such that M(i,j)=1 iff competitor i might play competitor j in round R, where 1<=R<=N. (In each round each surviving competitor plays his "next door neighbor" in the bracket.)

For example, if N=1, R=1 then

 M =
   [ 0 1
     1 0]

or if N=2, R=2 then

 M = 
   [ 0 0 1 1 
     0 0 1 1
     1 1 0 0 
     1 1 0 0 ]

Solution Stats

100.0% Correct | 0.0% Incorrect
Last solution submitted on Dec 23, 2014

Problem Comments

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more