SteelReed

Search

Search posts, questions…

Collections & DSAQuestion 16 / 25

Junior

What is Big-O, why do we drop constants, and when does Big-O mislead you?

Short answer

Big-O tells how fast cost grows as n gets bigger. Constants are dropped because for large n the growth rate decides.

YesSmall or mediumCompare two algorithmsLarge n?Growth rate decidespick lower Big-OConstants, cachecan winMeasure with JMH

3 points to say:

  1. Say time or memory, and which case.
  2. Amortized: an average over the whole sequence.
  3. For small n, constants and cache can win.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.