AlgoViz

Logarithms

easy 14 min

A logarithm answers "what power do I raise the base to?" In code, log2 n is how many times you can halve n before reaching 1, which is why binary search, balanced trees and divide and conquer all run in O(log n) and barely slow down as data grows.