Sort a list of records
Proof project · Article 8 of 8 · 2 min read
Use what you learned to sort real data and defend your choice.
The short version
Take a list of records, sort it by two fields, and explain which algorithm you used and why.
Try it yourself
Create a list of at least ten students with a grade and a name. Sort them by grade from high to low, with names in alphabetical order inside each grade. Use sorted() with a key, then repeat the task with your own merge_sort and compare the results.
Prove it
Both approaches print the same list, and you can explain in two sentences why a stable sort made the second field work.
Explain it to the duck
Walk through how you chose your algorithm and what would change if the list had ten million records.
Tested with: Python 3.13.
Where to go next
- Searching(opens in a new tab) Binary search needs sorted data, so it is the natural next step.
- Heaps and priority queues(opens in a new tab) Get the smallest item without sorting everything.
- Algorithm analysis Learn to compare algorithms by how their work grows with input size.