Suppose you are given a sequence or array of n real numbers: (a1, a2, . . . , an
ID: 3282432 • Letter: S
Question
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 don’t 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.
6) Arguethatforn?1,n!?nn.
7) Argue that for n ? 2, n! ? (n/2)n/2.
8) What can you conclude about the asymptotic growth / order of ln(n!)? What can you conclude about the minimal number of tests/comparisons needed to sort a list?
9) Argue that merge sort has a complexity of ?(n ln n) and therefore is, asymptotically, as or more efficient than any other sorting algorithm.
Bonus) What are the tightest (simple) bounds you can achieve and verify on ln(n!)?
Explanation / Answer
ANSWER:
Assume you be given an collection of n rudiments of which a[0] is the primary constituent plus a[n] is the previous constituent. To kind the collection of rudiments, there are so a lot of algorithms obtainable but if you transport the idea of total order of rudiments, then the difficulty cuts downward to assortment of one order.
1) How a lot of likely sum order permutation are present?
A) if you contain n separate genuine information in your collection, after that the figure of sum order permutation obtainable are n! which is not anything but the total figure of permutation of the n rudiments.
2) quarrel that if you know or are known the total order variation, then you can sort the list without any extra comparison or test.
A) stipulation you are known total order permutation, after that the process is to choose that arrange anywhere the rudiments of the collection are prearranged. in this container you do not contain to contrast the rudiments of the collection or you dont still contain to employ a categorization algorithm.
3) Argue so as to if you don’t know the whole order variation (or only know partial / incomplete information about it), you cannot genus the list with no added comparison or test.
A) If you dont know the total ordering permutation, then the elements of the array may have partially/not sorted and compulsorily we have to intercompare the elements of the array to get the sorting order.
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.
A) This fraction is difficult. if you evaluate two rudiments, then you have a small bit of in order and you can with no trouble position other rudiments with admiration to these two rudiments. think the container of dual sort/heap sort, all the rudiments in the hierarchy determination be in arrange and the new rudiments will be located in their equivalent place. The occasion intricacy of the sorting techniques are of order nlogn. If you use linear categorization algorithms, after that in the of inferior excellence container you do boast time difficulty of organize n2 (in case of bubble
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.