The crew holds a sorting challenge with paper cards. Each card has a number from 1 to 20.
Rocket sorts with selection sort. Raven keeps two tallies: one for comparisons, one for swaps.
"Ten comparisons, three swaps!" she reports. "What do you notice if we start with the cards already in order?"
"The comparisons stay the same," Rocket says. "But the swaps go to zero!"
Nova cheers. "Here is a hint for the next round. Try the cards in reverse order."
| Bonus recap statement | True or false? |
|---|---|
| Selection sort needs 4 passes for 5 cards. | ? |
| A sorted list needs 0 comparisons. | ? |
| sorted() keeps the original list. | ? |
| Sort once, then search many times. | ? |
Quest complete! Next week we split, sort and merge with merge sort.