subject

We are going to derive an upper bound for the average number of exchanges for quicksort. A similar analysis would give a lower bound, giving the high order term exactly.

(a) Assume that the partition (or pivot) element ends up in position q. How many exchanges does partition do, NOT counting the final exchange where the pivot element is placed in its proper sorted position? Briefly justify. Note that an element can exchange with itself.

(b) Write a recurrence for the expected number of exchanges (for quicksort), NOT counting the final exchange where pivot element is placed in its proper sorted position.

(c) Simplify the recurrence as much as reasonably possible (as we did in class for comparisons).

(d) Guess that the solution is at most an In n for some constant a. Use constructive induction to verify the guess and derive the constant a.

(e) Give an upper bound on how many exchanges involve the pivot element thoughout all of the partitions in the entire quicksort algorithm. Briefly justify.

(f) Add this value to your answer in Part (d) to get an upper bound on the total number of exchanges.

(g) Rewrite your solution using log base 2 rather than the natural log, evaluating the constant to three decimal places.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:10
Suppose we have a byte addressable computer that has a 32-byte cache with 8 bytes per block. the memory address is 8 bits long. the system accesses memory addresses (in hex) in this exact order: 6e, b9, 17, e0, 4e, 4f, 50, 91, a8, ab, ad, 93, and 94. (a) assuming the cache is direct mapped, what memory addresses will be in cache block 2 after the last address has been accessed? (b) assuming the cache is direct mapped, what is the hit ratio for the entire memory reference sequence given, assuming the cache is initially empty? (c) assuming the cache is 2-way set associative with a lru replacement policy, what is the hit ratio?
Answers: 3
question
Computers and Technology, 22.06.2019 21:10
Dameas communication challenge is due to which factor
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Anetwork security application that prevents access between a private and trusted network and other untrusted networks
Answers: 1
question
Computers and Technology, 25.06.2019 04:10
While creating a web page, what does each of the following html tags define? 1. 2. 3. 4. a. defines a new paragraph b. defines a term c. defines a single line break d. defines a heading
Answers: 1
You know the right answer?
We are going to derive an upper bound for the average number of exchanges for quicksort. A similar a...
Questions
question
Mathematics, 29.06.2021 05:50
question
Mathematics, 29.06.2021 05:50
question
Mathematics, 29.06.2021 05:50
question
Mathematics, 29.06.2021 05:50
question
Mathematics, 29.06.2021 05:50
question
Mathematics, 29.06.2021 05:50
question
Mathematics, 29.06.2021 05:50
question
Mathematics, 29.06.2021 05:50
question
Social Studies, 29.06.2021 05:50
Questions on the website: 13722363