Algorithmsgreedy selection
Greedy Selection Rules
TT
Testlaa Team
May 14, 2026•1 min read
Choose extremal element by a key that preserves future options.
Try this in Python
nums = [3, 1, 4, 1, 5]
print(min(nums), max(nums))
Key takeaways
- Argue that discarding non-extremal cannot beat extremal in your metric.
- For two keys, try sorting tuples.
- Stable sorts preserve secondary keys.
Tags:
GreedyPythonStudents
