sorting all rows would come out to be O(n*m*log(m))
which is different from yours,
as there are m columns and n rows. At this point we have only sorted the individual rows,
Then how to sort the whole row with other rows,,
and what would be time complexity of that.......
some inbuilt function available in C/C++ for it ,,, 