You have a printer that randomly shuffles the order of pages of your papers. To put your work back in order, you proceed through the stack on the printer as follows:
Given a page , if neither have been seen, create a new pile. If one of or have been seen, add to the front of ’s pile or the end of ’s pile. If both have been seen, merge the two piles into one. What’s an upper bound on the maximum number of piles you’ll have at any moment while reconstructing an page document?
We can think of this process as a series of binary strings. Each step can be represented by with the bit at index set if that page has been seen. If we count the expected instances of “” as a function of . Without too much effort, we see that . This is maximized around when . When is large, the maximum exceeds its expectation by .