5 ms·
Not sure of the universality of this, but my intuitive way of understanding O(log n) is as follows: An algorithm is O(log n) if you can reduce the solution spa
by jgross206 13y ago
Not sure of the universality of this, but my intuitive way of understanding O(log n) is as follows:
An algorithm is O(log n) if you can reduce the solution space (the set of all possible solutions) by a fraction (e.g. divide it in half or divide it into tenths) using a constant number of operations.
For example, binary search is O(log n) because you can cut the solution space in half (regardless of how big it is) by using a constant number of operations.