Friday 15 May 2015

python - Need help in understanding how the solution to rotate N*N matrice by 90 degree in place works -


I am trying to understand the solution to rotate the N * N array at the place of 90 degrees. This question was asked before, but now it is closed - [Link] The best answer given is beautiful, but I am not able to understand it, someone can interpret these steps

It is not necessary in Ajhen, because you can swap all four elements once in the same expression: [y], one [N-1-y] [x], one [y] [n-1-x], a [n-1- X] [n-1-y] = (a [y] [n-1-x], [n-1-y] [x], a [n-1- X] [y],

n × n matrix, n = 3:

  1 2 3 4 5 6 7 8 9   

N / 2 = 1 , (N + 1) / 2 = 2 .

x = [0, 2] (0 or 1), y = [0, 1] (0).

Corner:

  1 2 | 3 _____ | 4 5 6 7 8 9   

swap : 1 ounce ???? 3 a 7 a 9 (1 ??? 1) ; 2 o "6 one 8 one 4 (â ???? 2) < / Code>

5 × 5 matrix:

  abcdefghijklmnopqrstu Vwxy   < P>  N / 2 = 2 ,  (N + 1) / 2 = 3 .  

X = [0, 3] (0 or 1 or 2), y = [0, 2] (0 or 1).

Corner:

  ABC | DEFG H | I j ______ | K LMNOP QRSTUVWYY   

SWAP:

  AA ???? E y ??? Uf one ???? D â ???? T V b â ???? Jm x pg a ???? I have a ???? S â ???? QA AO ??? Ya ???? K H ??? N â ???? RL    

No comments:

Post a Comment