Coding & Algorithms (DSA)

Complexity Analysis

6 practice questions. Free questions open a full answer guide; the rest unlock with Pro.

  • Adding to a dynamic array is O(1) amortized even though some inserts trigger an O(n) resize. Explain why, and how you'd justify that bound to a teammate who only sees the occasional slow append. Mid level
  • Engineers often quote a dynamic array's append as O(1), yet a single append can be O(n). Explain how amortized analysis reconciles that, and when an amortized bound is the wrong thing to promise.Go Pro Senior level
  • A teammate dismisses an algorithm choice with 'they're both O(n), so it doesn't matter.' When is reasoning purely from Big-O misleading in production, and what do you weigh beyond the asymptotic label?Go Pro Senior level
  • Two algorithms for the same task are O(n log n) and O(n^2). When would you reach for the O(n^2) one anyway? Explain what Big-O actually leaves out.Go Pro Mid level
  • When you analyze an algorithm, you usually talk about its time complexity. How do you reason about its space complexity, and what's the difference between an in-place algorithm and one that uses O(n) extra space?Go Pro Junior level
  • Appending to a dynamic array (a Python list or a Java ArrayList) is usually described as O(1), yet sometimes a single append is clearly slower than the rest. How can it be O(1) when one append occasionally does extra work?Go Pro Junior level
Want questions matched to your role? Paste a job title, job description, or CV for a personalized set, or go Pro to unlock the full bank.