Sort first
Also written: sorted, sorted(items, key=…)
A pattern: sort the data so related items sit next to each other, which costs O(n log n). Python's `sorted` returns a new sorted copy and accepts a `key=` function.
Also written: sorted, sorted(items, key=…)
A pattern: sort the data so related items sit next to each other, which costs O(n log n). Python's `sorted` returns a new sorted copy and accepts a `key=` function.