Puzzle 2 of 26 · Hard
One bubble-sort pass
Your answer
The numbers 1 to 5 are put in a random order. You make one bubble-sort pass: go left to right, swapping each neighbouring pair that’s in the wrong order. What’s the chance the list is sorted after that one pass?
Right answers go through as you type.
Show the solution
Answer: 2/15 ≈ 13.3%
Step 1 · In one pass, a number moves left at most 1 place
The pass carries the biggest number so far to the right. Anything it passes shifts left by just one place.
Step 2 · So number k must start in the first k + 1 places
To end in place , number can start at most one place to its right. That’s the only thing that can go wrong.
Step 3 · Place 1, then 2, then 3 …
Each number has 2 allowed spots left when you place it (the last has 1). So 16 orders get sorted.
Step 4 · Chance
All 120 orders are equally likely, and 16 of them get sorted.
Answer
Step 4 of 4