TheScalableDev
Sign in
FoundationsBeginner8 minvocabulary lesson · one formula to rememberFree

Foundations - Logarithms for Engineers

A logarithm asks 'how many times must I halve (or double)?' - the math hiding inside binary search, balanced trees, and every O(log n) promise.

01 / 05

The only definition you need

one sentence

log₂(16) asks: '2 raised to what power gives 16?' Answer: 4. Equivalently: 'how many times can I halve 16 before reaching 1?' Same answer - and that halving view is what engineers use.

log₂(32) equals…

Where you will see it

Real systems that use this exact idea. Tap a card to open it.

Common traps

The mistakes interviewers watch for. Guess the fix, then reveal it.

  1. FixEngineers default to log₂; other bases differ only by a dropped constant.

  2. FixLinear grows with input; logarithmic grows with the number of halvings.

  3. FixCount the cuts instead - it generalizes to any number instantly.

Interview prep

Questions you could be asked, with the depth an interviewer wants to hear.

Each comparison discards half the remaining items; reaching one item takes log₂(n) halvings.

halving count

DeeperShow the 1024→10 example concretely.