nrows: number of rows
ncols: number of columns
int **arra = (int **)malloc( sizeof(int*) * nrows );
int *ar = (int *)malloc( sizeof(int) * nrows * ncols );
for( int a = 0; a nrows; a ++ ) {
arra[a] = ar + ncols * a;
}
now index of array i and j can be
@Abhi: if you apply quick sort then again the order will will not be intact
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/ic2CXJXSGuoJ.
To post to this
@Navin: as you say you have to take stack or some other data structure
then it will definately not be donw in O(1) space complexity i think the
recursive solution is best because we are not explicitly using any extra
space its internal stack is using this space.
--
You received this message