Exercise · Volume 1 · 2.2.1-6
Exercise 2.2.1-6
not stated yet in Lean solution written
| Rating | 00 |
|---|---|
| Kind | K3, find a value: compute a number, a set or a closed form from the written solution |
| Section | Section 2.2.1 of Volume 1 |
The task
Say which permutations of a queue can give.
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
A queue gives up its items in the order of their arrival.
Solution
Show the solution
Only the identity permutation . The cars enter the queue in the order . A queue always removes its oldest item, so the cars leave in the order in which they came in. Every move sequence ends with the output .
Check
I ran a queue on all legal sequences of inserts and removals for . The output was each time.
Remarks
A queue keeps the order of the input. A stack reverses a block of it. The deque of the following exercises can do more than either.
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.