Question
Suppose you are given a sequence or array of n real numbers: (a1, a2, . . . , an). We are interested in sorting this
Suppose you are given a sequence or array of n real numbers: (a1, a2, . . . , an). We are interested in sorting this list, and ideally sorting it as efficiently as possible / with minimal effort. We can summarize the total ordering information in terms of a permutation of the numbers 1 to n. For instance, given (a1, a2, a3), a total ordering permutation of 3, 1, 2 would tell us that a3 ? a1 ? a2, and therefore that the sorted form of the list would be (a3, a1, a2).
1) How many possible total ordering permutations are there?
2) Argue that if you know or are given the total ordering permutation, then you can sort the list without any additional comparisons or tests.
3) Argue that if you dont know the total ordering permutation (or only know partial / incomplete information about it), you cannot sort the list without additional comparisons or tests.
4) Taking this view, argue that any sorting algorithm must do at least enough work to determine the total order permutation of the list.
5) If every element comparison (testing whether ai ? aj ) provides one bit of information, argue you need at least on the order of ln(n!) many tests/comparisons to sort the list.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started