Pattern Recognition Drill
Easy Sorting
The Problem
Sort an array using insertion sort.
What approach would you use?
Think about it before scrolling down.
For each element, shift larger elements right and insert. O(n²) worst case, O(n) best (nearly sorted).
Common Trap
This is an algorithm implementation drill, not a problem-solving drill. Know the invariant: left portion is always sorted.