## Invitation to Computer Science 8th Edition

Let's denote the U marker as / the C marker as / The list $[4,8,2,6]$ $-$ Set $\mathrm{U}$ at the end $;[4,8,2,6 /]$ $-$ Set $C$ at the second; $| 4 / 8,2,6 /$ $-$ since $8>4$ simply move $C$ to the right $| 4,8, / 2,6 /]$ $-$ Now $2<8$ so exchange them and move $C :[4,2,8, / 6 /]$ $-6<8$ so exchange, move $C :[4,2,6,8 / /]$ $-$ C has reached U so move U to the left and $C$ to the second element again:$[4,/2,6/8]$ $-2<4,$ exchange, move $\mathrm{C} :[2,4, / 6, / 8 |$ $-$ Just move $C :[2,4,6, / / 8 |$ - Move U to the left, and $C$ to the second: $[2/4/6,8]$ - Continue until U reaches the first element.