Efficiency is important; people don’t like waiting for computers to slowly do things that ought to be fast.
So far we’ve been thinking about this in vague terms; we know, for example:
- Getting from an array-list is faster than from a linked list,
- Binary search is faster than linear search,
- Merge sort is faster than selection sort.
Now it’s time to go into detail: how do we know how fast an algorithm is?