I need to create an algorithm in C to rotate a 10x10 matrix by 90 degrees, though I can not use an auxiliary array for that.
Simplifying what was asked to try to find some pattern and use it to solve the problem I used a 3x3 array and compared the position that each element occupies in the original array and that will occupy in the rotated array.
ORIGINAL | ROTACIONADA
0x0 0x1 0x2 | 0x2 1x2 2x2
1x0 1x1 1x2 | 0x1 1x1 2x1
2x0 2x1 2x2 | 0x0 1x0 2x0
You can see a pattern in which for the original matrix the value of the line remains constant for each cycle of 3 positions and the value of the column is increased by 1 in this same cycle. For the rotated version of the array the row and column values respectively correspond to the column and row.
Although I do not know how to take advantage of this information, since transferring the values to the positions corresponding to the rotated version will lose values that I will still use.
For example:
Transferring the value from 0X0 to 2X0 will lose the original 2x0 content that you would need to transfer to 2x2 later.