I have a non-square array like this:
const int dim1 = 3, dim2 = 4; int array[12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12};
and I need to convert it to:
{3,6,9,12, 2,5,8,11, 1,4,7,10}
i.e. rotate / shuffle it counterclockwise (or clockwise, the algorithm should be similar).
The algorithm should use minimal space. I have to rotate the image in an environment with limited memory, so the less space, the better. Speed ββis not such a big problem.