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.
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: 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
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...
Number conversion between hexadecimal and binary. Show the working steps. a) Convert the hexadecimal number E4D2...
Number conversion between hexadecimal and binary. Show the working steps. a) Convert the hexadecimal number E4D2 into binary. b) Convert the binary number 1100010111110011 into hexadecimal
**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...
PROBLEM 2. Based on data from Consumer Reports, replacement times of TVs is on average 3.4...
PROBLEM 2. Based on data from Consumer Reports, replacement times of TVs is on average 3.4 years with the standard deviation of 1.2 years. Answer the following questions. Question 2 (2 points): A random sample of 41 TVs is selected. Find the probability that their average replacement time is between 3 and 4 years. a) 0.6472 b) 0.9827 c) 0.3208 d) None of the above Question 3 (2 points): If a random sample of 29 TVs was chosen, what would...
1) Convert negative fractional decimal number to 8-bit binary number: – 16.625 (use 2's complement binary...
1) Convert negative fractional decimal number to 8-bit binary number: – 16.625 (use 2's complement binary format) Hint: –17 + 0.375 Given the hint above, the fractional number will be divided into two parts, - Whole number, - Fractional part, must be positive (2) Proof to check that your calculation above is correct
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT