Complexity analysis interview questions

Big O in plain words, reading the cost of loops and recursion, amortised and space costs, what Python's built-in operations really cost, and which input sizes fit which algorithms.

5 quick facts

– interview-ready · 14 questions in this topic

– of 14 tried

Saved on this device. Interview-ready means you got it right on two different days. Guesses and hints count for less.

Questions

  1. Big O in plain wordsPredict
  2. Reading the cost of loopsPredict
  3. Where O(log n) comes fromPredict
  4. Amortised cost: cheap on average, sometimes slowPredict
  5. Space complexity and the call stackPredict
  6. What common Python operations costPredict
  7. Which complexity fits which input sizePredict
  8. Best, average and worst casePredict
  1. Working out the cost of recursionPredict
  2. How fast can sorting be?Predict
  3. The cost of building stringsPredict
  4. The cost table for common data structuresPick the fix
  5. Answer many range-total questions quicklyFill the blank
  6. Raise a number to a huge power, modulo mPredict

Practise this topic

Flashcards · 24

Flip, then say if you knew it. Needs JavaScript; every answer is also on its question page.

Quick quiz · 14 questions

One exercise per question, checked as you go. Needs JavaScript.

Mock interview · 2 sets

Timed, out loud, then tick what you covered. Needs JavaScript.

Quick facts

Recall the answer first, then tap Show to check.

Sources: Topic outline informed by the Tech Interview Handbook by Yangshun Tay and the NeetCode 150 pattern grouping by neetcode-gh, both MIT licensed. Every problem, solution and explanation is written by Best Latest Apps. Credits and license