Maths Olympiad Prep

Library / /10 of 17

, 2012

Combinatorics Difficulty 6.5 National olympiad Prove it Canada

A bookshelf contains nn volumes, labelled 11 to nn in some order. The librarian wishes to put them in the correct order as follows. The librarian selects a volume that is too far to the right, say the volume with label kk, takes it out, and inserts it so that it is in the kk-th place. For example, if the bookshelf contains the volumes 11, 33, 22, 44 in that order, the librarian could take out volume 22 and place it in the second position. The books will then be in the correct order 11, 22, 33, 44.

a. Show that if this process is repeated, then, however the librarian makes the selections, all the volumes will eventually be in the correct order.

b. What is the largest number of steps that this process can take?

Une étagère contient nn volumes étiquetés de 11 à nn, rangés dans un certain ordre. Le bibliothécaire souhaite les mettre dans le bon ordre de la façon suivante : il choisit un volume qui se trouve trop à droite, par exemple le volume étiqueté kk, le retire de son emplacement et l'insère à la kk-ième place. Par exemple, si les volumes sont rangés dans l'ordre 11, 33, 22, 44, le bibliothécaire peut prendre le volume 22 et le mettre à la deuxième place. Les livres sont alors rangés dans le bon ordre, soit 11, 22, 33, 44.

a) Démontrez que si l'on répète ce processus, tous les volumes finiront par être dans le bon ordre, et ce, quelle que soit la manière dont le bibliothécaire les range.

b) Quel est le plus grand nombre d'étapes que peut exiger un tel processus?

Solution

(a) If tkt_k is the number of times that volume kk is selected, then we have tk1+(t1+t2++tk1)t_k \le 1 + (t_1 + t_2 + \dots + t_{k-1}). This is because volume kk must move to the right between selections, which means some volume was placed to its left. The only way that can happen is if a lower-numbered volume was selected. This leads to the bound tk2k1t_k \le 2^{k-1}. Furthermore, tn=0t_n = 0 since the nnth volume will never be too far to the right. Therefore if NN is the total number of moves then
N=t1+t2++tn11+2++2n2=2n11, N = t_1 + t_2 + \dots + t_{n-1} \le 1 + 2 + \dots + 2^{n-2} = 2^{n-1} - 1,

and in particular the process terminates.

(b) Conversely, 2n112^{n-1}-1 moves are required for the configuration (n,1,2,3,,n1)(n, 1, 2, 3, \ldots, n-1) if the librarian picks the rightmost eligible volume each time.
This can be proved by induction: if at a certain stage we are at (x,nk,nk+1,,n1)(x, n-k, n-k+1, \ldots, n-1), then after 2k12^k-1 moves, we will have moved to (nk,nk+1,,n1,x)(n-k, n-k+1, \ldots, n-1, x) without touching any of the volumes further to the left. Indeed, after 2k112^{k-1}-1 moves, we get to (x,nk+1,nk+2,,n1,nk)(x, n-k+1, n-k+2, \ldots, n-1, n-k), which becomes (nk,x,nk+1,nk+2,,n1)(n-k, x, n-k+1, n-k+2, \ldots, n-1) after 1 more move, and then (nk,nk+1,,n1,x)(n-k, n-k+1, \ldots, n-1, x) after another 2k112^{k-1}-1 moves. The result follows by taking k=n1k=n-1.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic and difficulty added by this site.