Exercise · Volume 1 · 1.2.10-1
Exercise 1.2.10-1
not stated yet in Lean solution written
| Rating | 10 |
|---|---|
| Kind | K3, find a value: compute a number, a set or a closed form from the written solution |
| Section | Section 1.2.10 of Volume 1. Companion chapter: Analysis of an algorithm |
The task
Find from the recurrence (4) and the start (5), and say what it means for Algorithm M.
The exact wording is in your copy of the book.
Hints
Open one hint at a time. Try the exercise again after each.
Hint 1
Put in (4). The term with vanishes by (5).
Hint 2
Multiply the resulting ratios.
Solution
Show the solution
For Eq. (4) reads . The first term is zero, because for . So for , and . Then
The step M4 is not executed at all exactly when is the largest of the distinct keys. Each key is the largest with probability when all orders are equally likely.
Check
For the table of the six permutations has two cases with , so . A brute-force count over all permutations for gives in each case.
Remarks
The same recurrence for gives directly from (7) and (8): .
This solution is drafted, and a person has not reviewed it yet. The source.
In Lean
not stated yet The exercise is not stated in Lean yet.
The status is computed from the Lean build. The node of the map.
Something is wrong? Report it.