Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: