An imaginary compiler uses an imaginary array ordering to represent multi-dimensional arrays into 1-D arrays.Say,this imaginary ordering is called spiral ordering.It works like:
Given 2-D array-{{1,2,3,4}{5,6,7,8}{9,10,11,12}{13,14,15,16}} then the 1-D array will be {1,2,3,4,8,12,16,15,14,13,9,5,6,7,11,10}
Deduce the general formula for calculating the address of an element at (x,y) position in a 2-D array,given the address of the element at (0,0).