1.5k views
0 votes
Suppose you are given a sequence or array of n real numbers (a1, a2, . . . , an), all distinct. We are interested in sorting this list, and ideally sorting it as efficiently as possible / with minimal effort. All information relevant to sorting a list can be thought of as contained in the order permutation. If a list (a1, a2, a3) has an ordering permutation of (3, 1, 2), that would mean a3 ≤ a1 ≤ a2, hence, the sorted form of the list would be (a3, a1, a2). This permutation encodes how all the elements compare to one another.

1) How many possible ways could a list of n values be ordered, i.e., how many ordering permutations are there?
2) Argue that if you know a list’s order permutation, sorting is easy (linear time), and conversely, if you know the steps to sort the list, you can easily generate the order permutation.
3) Given this, argue that sorting can’t be easier than finding the order permutation.
4) If every element comparison (testing where ai ≤ aj ) provides at most one bit of information, argue that in order to be able to sort any list, you need to perform at least approximately log2 (n!) many comparisons.
5) Based on the prior result, argue that merge sort is, asymptotically, as or more efficient than any other sorting algorithm.

User Tongfa
by
5.2k points

1 Answer

5 votes

Answer:

1. n

2. we can slect that permutation without any comparison and the array wil be sorted in to one time.

3. we cannot sort the list without any comparision test.

Step-by-step explanation:

1. The total number of permutations available are n! because there are ' n ' distinct elements in an array.

2. Here we are given the total ordering permutations, among those available permutations there will be one permutation in which all the elements of the array are sorted. so, we can slect that permutation without any comparison and the array wil be sorted in to one time.

3. If there is no total ordering permutation then we cannot sort the list without any comparision test. In this case we should know the the number of inversion required to see the array. Based on the permutations we can select the permutation which requires minimum inversions. Here inversion sort works well.

See attachment for the details of 4 and 5.

Suppose you are given a sequence or array of n real numbers (a1, a2, . . . , an), all-example-1
Suppose you are given a sequence or array of n real numbers (a1, a2, . . . , an), all-example-2
User Rresino
by
5.6k points