Engrain by ByteRush

DSA.02.02 JuniorCore — asked often

Space complexity, recursion and amortised cost

Comes up in: DSA, Recruiter screen

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • auxiliary space
  • recursion stack space
  • amortised O(1) push on dynamic arrays
  • hash map average vs worst
  • complexity of common JS methods (includes, indexOf, slice, splice, sort, spread)

Words you will know

space complexityamortised analysisauxiliary space

What you will practise

  • complexity of 10 JS built-ins quiz

Interview questions this answers

  • What is the complexity of Array.prototype.sort in V8?
  • How much stack space does a recursive DFS use?