Question: Consider the following two - dimensional sorting problem: we are given an arbitrary array of n 2 numbers ( unsorted ) , and have to
Consider the following twodimensional sorting problem: we are given an arbitrary array of nnumbers unsorted and have to output an n times n matrix of the inputs in which all rows andcolumns are sorted.As an example, suppose n so n Suppose the numbers are just the integers Then possible outputs include but are not limited toIt is obvious that we can solve this in On log n time by sorting the numbers and then usingthe first n as the first row, the next n as the second row, etc. For this question, you should provethat this is tight. Formally, you should prove that in the comparison model, this problem cannotbe solved in on log n time. For simplicity, you can as always assume that n is a power of Hints: instead of reasoning directly about the decision tree, show that if we could solve thisproblem with on log n comparisons then we could break the sorting lower bound we could sortan array of size n using fewer than logn comparisons Useful facts to keep in mind are thatn! nen and that we can merge two sorted arrays of length n using n comparisons. Youmight need to be careful with constants
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
