Lets say you have a machine, which sometimes prints out the time on a piece of paper in the following format: $$year-month-day-hours-minutes-seconds.$$
For example today it would print something like $$11-12-27-20-03-58,$$ then maybe two and a half hour later $$11-12-27-22-45-32,$$ and so on. You're investigating this machine and collect all the output it gives you. For convenience you write down a running number on the backs of these papers. This way you can sort and find the prints much faster. On the first ever print you wrote #1, on the second one you wrote #2, etc. When you reached #9999 you decided to switch to hexadecimal numbers to safe some space.
Then you have a better idea: You write a program to automatize this. Whenever the machine prints out a new time, the programm should write down which print it is in the above sense. There is only one problem: The program you'll write can't count, i.e. remember how many prints it has done. However, the program has access to the time printed on the paper. So it could just use the time itself to encode the order. But this is probably a waste of space.
Here the question: How can you optimally use the information you got to convert it into a sorted series, even if every time you only have access to the current print?
How can the solution to this specific problem be generalized? (i.e. not necessarily relying on this example, where the input is a time.)