In this lesson
- It starts with a question. You will search the same list of 10,000 records a thousand times. Is it worth sorting first?
- The idea you will find. Count the operations, not the seconds. — On a list of a million, checking every item is a million steps; a halving search is about twenty. Sorting costs more than one search but far less than a thousand of them. Thinking in counts rather than seconds is what lets you predict performance before writing a line.
- How you learn it. By doing: putting things in order, a slider.
- Length. 5 short steps. Progress saves on this phone.
Part of Python: Sorting & Searching
Sorting, searching and counting — and knowing which approach survives a big list.