Time and Space Complexity Analysis Questions

Reasoning about algorithmic efficiency: Big-O/Theta/Omega notation, amortized analysis, recurrence solving, and the time-versus-space trade-off. Covers deriving bounds from code, comparing candidate approaches, and communicating complexity clearly under interview pressure. The analytical layer applied across every algorithm topic.

HardTechnical
43 practiced

Explain how blocking (tiling) improves the performance of matrix multiplication on CPUs and GPUs without changing its asymptotic complexity. Given a cache size C and element size s, describe how you would choose a tile size T to maximize cache reuse and reduce memory-bandwidth pressure.

MediumTechnical
48 practiced

A dynamic array (Python list, Java ArrayList, C++ vector) doubles its backing capacity whenever it fills up. Prove, using either the aggregate method or the accounting (banker's) method, that a sequence of n append operations costs O(n) total, and therefore O(1) amortized per append, even though an individual append can cost O(n) in the worst case.

EasyTechnical
58 practiced

Explain the difference between worst-case, average-case, and amortized time complexity, using hash-table operations as your running example. When would you quote each framing to an interviewer or a teammate, and why does 'hash table lookup is O(1)' quietly assume average case?

EasyTechnical
67 practiced

You are handed this loop: for i in range(n): x = arr[i] * 2. Explain its time and space complexity when arr is (a) a plain Python list and (b) a NumPy ndarray processed with vectorized operations instead of the explicit loop. Discuss why the asymptotic complexity class is the same in both cases but the practical constant factor differs by orders of magnitude.

HardTechnical
56 practiced

Explain the trade-offs of mixed-precision training (using float16 activations and weights with an float32 master-weight copy). What memory and compute speedups does it give, and what numerical failure mode (gradient underflow) does it introduce and how is it typically mitigated (loss scaling)?

Unlock Full Question Bank

Get access to all Time and Space Complexity Analysis interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.