Exercise · Volume 1 · 2.2.1-12
Exercise 2.2.1-12
not stated yet in Lean solution written
| Rating | HM34 |
|---|---|
| Markers | HM (needs higher mathematics) |
| Kind | K4, find an estimate: give an asymptotic form or a bound from the written solution |
| Section | Section 2.2.1 of Volume 1 |
The task
Find the asymptotic values of (the stack count of Exercise 2.2.1-4) and of (the deque count of Exercise 2.2.1-11).
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
For , use Stirling's formula.
Hint 2
For , the generating function has a square root. Find its singularities and their size. The nearest one to the origin gives the growth.
Solution
Show the solution
Plan. Use Stirling's formula for . For , find the dominant singularity of the generating function, write the function there as a square root times an analytic factor, and transfer the singular term to the coefficients.
The numbers . By Stirling's formula, . Divide by :
The numbers . The generating function is . The polynomial has the roots and . Since , the function is analytic in the whole plane except for the branch cuts that start at and . So is the only singularity on the circle , and extends analytically to a slightly larger region with a notch at .
Near write The function is analytic at , with The coefficient of in is . The transfer theorem of Flajolet and Odlyzko moves this estimate to , with the factor and the scale :
Now simplify the constant. Since , and , we have . Also . Hence
The growth rates are for and for .
Check
I computed the exact ratio of and to their formulas. For the ratio is at and at . For it is at , at , and at . The distance from falls like in both cases. The two forms of the constant agree: and .
Remarks
A deque with restricted output thus gives about times as many permutations as a stack. The book's answer reaches the formula for by a direct expansion of the coefficients, and the transfer from the singularity is another route to the same constant.
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.