Yours approach is good to get answer.
>From my best understanding
yours algorithm will take 1^2 + 2^2 + 3^2 + . + N^2 + (N-1)^2 +
.+ 1^2
to place all array into 1D array. which evaluates to O(N^3) with O(N^2)
space storage.
Actually there is an idea to take every element
I post you 2 problems
First:
There are two N x N arrays which are sorted by row and column.
The problem is to find efficiently a N x N array from the two such that
the resultant array is sorted by row and column and it should contain
the
N^2 elements which are least of all 2N^2 elements in the