Consider the problem of sorting an n x n
matrix (i.e. the rows and columns are in ascending order). I want to find the lower and upper bound of this problem.
I found that it is O(n^2 log n)
by just sorting the elements and then outputting the first n
elements as the first row, the next n
elements as the second row, and so on.
however i want to prove that it is also Omega(n^2 log n)
.
After trying smaller examples, I think I should prove that if I can solve this problem using less than n^2 log(n/e)
comparisons, it would violates the log(m!)
lower bound for comparisons needed to sort m
elements.
Any ideas on how to prove that?