InterviewStack.io LogoInterviewStack.io

Complexity Analysis and Performance Modeling Questions

Analyze algorithmic and system complexity including time and space complexity in asymptotic terms and real world performance modeling. Candidates should be fluent with Big O, Big Theta, and Big Omega notation and common complexity classes, and able to reason about average case versus worst case and trade offs between different algorithmic approaches. Extend algorithmic analysis into system performance considerations: estimate execution time, memory usage, I O and network costs, cache behavior, instruction and cycle counts, and power or latency budgets. Include methods for profiling, benchmarking, modeling throughput and latency, and translating asymptotic complexity into practical performance expectations for real systems.

HardTechnical
0 practiced
Provide a formal amortized analysis (use either the accounting method or potential method) to show that appending to a dynamic array that doubles its capacity has O(1) amortized cost per append. Then analyze growth factors of 1.5 and 3: compute amortized cost and steady-state memory overhead, and discuss which growth factor you'd choose for a memory-constrained production system vs a performance-sensitive service.
HardTechnical
0 practiced
Plan a large-scale benchmarking experiment to compare a new model version against production for throughput and tail latency. Include traffic generation (arrival distributions), dataset seeding, warm-up policy, measurement windows, metrics to collect (p50/p95/p99, CPU/GPU utilization, GC pauses), sample size and statistical tests for regressions, and how to safely run the test without impacting real users.
MediumTechnical
0 practiced
Implement a memory-efficient Bloom filter in Python that supports add() and contains() with a target false-positive rate of 1% for 1,000,000 items. Show how to compute the optimal bit-array size m and number of hash functions k, provide working Python code using hashlib or mmh3, and analyze time/space complexity. Finally, discuss limitations of a Python implementation in production (GIL, memory overhead for bit arrays) and alternatives.
HardTechnical
0 practiced
You ran Linux 'perf stat' on a compute-heavy kernel and observed: instructions = 1.0e11, cycles = 3.5e11, L1-dcache-misses = 2e7, L2-dcache-misses = 1e6, branch-misses = 5e5. Compute the CPI (cycles per instruction) and interpret whether the application is CPU-bound or memory-bound. Propose code-level and compiler-level optimizations to reduce cycles and cache-misses and explain how you'd verify improvements using perf.
HardTechnical
0 practiced
You ran an A/B microbenchmark with 50 latency samples for Server A (mean=20ms, sd=5ms) and 50 for Server B (mean=18ms, sd=6ms). Perform a two-sample t-test at α=0.05 to determine if Server B is significantly faster. Show calculations for the t-statistic, approximate degrees of freedom, and a 95% confidence interval for the mean difference. Finally, estimate the sample size required to detect a 1ms difference with power = 0.8 (assume pooled sd approx 5.5ms).

Unlock Full Question Bank

Get access to hundreds of Complexity Analysis and Performance Modeling interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.