Computers and Technology

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 ln 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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, smariedegray
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
image
Computers and Technology, 22.06.2019 23:00, brookerebman15
Which type of tab stop is most for weights and measurements?
Answers: 1
image
Computers and Technology, 23.06.2019 06:20, Ab20600
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, hunteryolanda82
Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? explain the basis for your answer. with a significant economic recovery, what do you think will happen to future enrollments in graduating engineering programs?
Answers: 1
Do you know the correct answer?
We are going to derive an upper bound for the average number of exchanges for quicksort. A similar a...

Questions in other subjects: