A storage depot consists of a 2 dimensional array of slots. Each object to be stored in the depot has a unique serial number. When an object with sequence number K arrives, it is stored according to the following pair of rules.

- If K is bigger than the sequence numbers in row 1, add K at the end of row 1.
- Otherwise, find the smallest sequence number bigger than K in row 1, say L. Replace object L by K and insert L into row 2 using the same pair of rules.

Problem: Given the final configuration of a depot, construct all input sequences that could have given rise to the depot.

©IARCS 2012–2016

PÄ›stujeme web | visit: Skluzavky