Question

In: Advanced Math

(§3.4 # 3) Use the previous problem to show that the average number of binary comparisons...

(§3.4 # 3) Use the previous problem to show that the average number of binary
comparisons required to sort n items is at least O(n log2 n).

Solutions

Expert Solution

The sorting algorithm must output a permutation of the input . The key to the argument is that

(a) there are n! different possible permutations the algorithm might output, and

(b) for each of these permutations, there exists an input for which that permutation is the only correct answer.

In fact, if we fix a set of n distinct elements, then there will be a 1-1 correspondence between the different orderings the elements might be in and the permutations needed to sort them.

Given (a) and (b) above, we can fix some set of inputs (e.g., all orderings of {1, 2,... ,n}), one for each of the output permutations. Let S be the set of these inputs that are consistent with the answers to all comparisons made so far so, initially, . We can think of a new comparison as splitting S into two groups: those inputs for which the answer would be YES and those for which the answer would be NO.

Now, suppose an adversary always gives the answer to each comparison corresponding to the larger group. Then, each comparison will cut down the size of S by at most a factor of 2. Since S initially has size , and by construction, the algorithm at the end must have reduced down to 1 in order to know which output to produce, the algorithm must make at least comparisons before it can halt.

We can then solve =

​​​​​​​


Related Solutions

Problem 3. Let Cξ and Cν be two Cantor sets (constructed in previous HW ). Show...
Problem 3. Let Cξ and Cν be two Cantor sets (constructed in previous HW ). Show that there exist a function F : [0, 1] → [0, 1] with the following properties (a) F is continuous and bijective. (b)F is monotonically increasing. (c) F maps Cξ surjectively onto Cν. (d) Now give an example of a measurable function f and a continuous function Φ so that f ◦ Φ is non-measurable. One may use function F constructed above (BUT YOU...
Problem 3. Let Cξ and Cν be two Cantor sets (constructed in previous HW ). Show...
Problem 3. Let Cξ and Cν be two Cantor sets (constructed in previous HW ). Show that there exist a function F : [0, 1] → [0, 1] with the following properties (a) F is continuous and bijective. (b)F is monotonically increasing. (c) F maps Cξ surjectively onto Cν. (d) Now give an example of a measurable function f and a continuous function Φ so that f ◦ Φ is non-measurable. One may use function F constructed above (BUT YOU...
Consider the "typical-case" performace for the search algorithsms. In orther words the average number of comparisons...
Consider the "typical-case" performace for the search algorithsms. In orther words the average number of comparisons needed over all possible positions where the elements can be found. a) used to locate and element in a list of n terms with linear search b) used to locate an element in a list of n= n^k terms using binary search.
Problem: Convert the following binary number to decimal. 1. 110101.101 Problem: Convert the following decimal number...
Problem: Convert the following binary number to decimal. 1. 110101.101 Problem: Convert the following decimal number to fractional binary representation. 1. 103.5625
To improve comparisons of profitability of firms, an analyst could use the average depreciation expense in...
To improve comparisons of profitability of firms, an analyst could use the average depreciation expense in the industry to compute a company’s hypothetical depreciation expense. TRUE OR FALSE
Problem 3. The average number of thefts at LeBow is three per month. (a) Estimate the...
Problem 3. The average number of thefts at LeBow is three per month. (a) Estimate the probability, p, that at least six thefts occur at LeBow during December. (What inequality are you using?) (b) Assume now (for parts (b), (c), and (d)) that you are told that the variance of the number of thefts at LeBow in any one month is 2. Now give an improved estimate of p (using an inequality). (c) Give a Central Limit Theorem estimate for...
**SHOW ALL WORK IN EXCEL QM** Problem-5: In the previous problem suppose the sale of football...
**SHOW ALL WORK IN EXCEL QM** Problem-5: In the previous problem suppose the sale of football programs described by the probability distribution only applies to days when the weather is good. When poor weather occurs on the day of a football game, the crowd that attends the game is only half of capacity. When this occurs, the sales of programs decreases, and the total sales are given in the following table: Number (in 100s) of Programs Sold Probability 12 0.25...
Suppose (A,∗) be an associative, unital, binary operation with inverses. Show that if|A|≤3,then in fact, (A,∗)...
Suppose (A,∗) be an associative, unital, binary operation with inverses. Show that if|A|≤3,then in fact, (A,∗) isalsocommutative, even though we didn’t assume it at the beginning.
Do you think it would be a good method to use the average of the previous...
Do you think it would be a good method to use the average of the previous three months actual expenses as the current periods estimate? What are some advantages and disadvantages of this approach?
Convert the binary numbers to decimal. Show a single sample calculation for the first number (10010010)....
Convert the binary numbers to decimal. Show a single sample calculation for the first number (10010010). 0111 1111 1001 0110 0101 1100 1100 0111
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT