InterviewStack.io LogoInterviewStack.io

Algorithms and Data Structures Questions

Comprehensive understanding of core data structures such as arrays, linked lists, stacks, queues, hash tables, trees, heaps, and graphs, and fundamental algorithms including sorting, searching, traversal, string manipulation, and graph algorithms. Ability to analyze and compare time and space complexity using asymptotic notation such as Big O, Big Theta, and Big Omega, and to reason about trade offs between different approaches. Skills include selecting the most appropriate data structure for a problem, designing efficient algorithms, applying algorithmic paradigms such as divide and conquer, dynamic programming, greedy methods, and graph search, and implementing correct and robust code for common interview problems. At more senior levels, this also covers optimizing for large scale through considerations of memory layout, caching, amortized analysis, parallelism and concurrency where applicable, and profiling and tuning for performance in realistic systems.

HardTechnical
88 practiced
Design an algorithm to compute pairwise Pearson correlation coefficients between many feature vectors efficiently on GPU when the number of features is large and cannot fit full pairwise matrix in memory. Discuss blocking, streaming dot-product computation, numerical stability for mean/variance, and how to exploit BLAS routines. Provide pseudocode for blocked computation.
MediumTechnical
103 practiced
Scenario: your team needs a feature-store data structure to serve millions of sparse categorical features with low-latency reads and occasional writes. Choose among hash tables, sorted arrays (B+-tree), compressed sparse row (CSR), and an on-disk key-value store. For each option, explain algorithmic access patterns, memory layout, concurrency model, eviction policy, and why you would pick one for serving high-QPS model inference.
HardTechnical
103 practiced
Describe algorithms for k-means clustering when data cannot fit in memory: explain streaming/minibatch k-means and provide pseudocode for the minibatch update step. Discuss convergence guarantees, learning rate schedules, and initialization strategies like k-means++ in the streaming context.
MediumTechnical
100 practiced
Implement Disjoint Set Union (Union-Find) with path compression and union by rank in Python. Provide functions find(x) and union(x, y). Explain amortized time complexity and an example use-case in clustering or Kruskal's MST for ML feature graphs.
MediumTechnical
80 practiced
Implement Tarjan's algorithm in Python to find articulation points (cut vertices) and bridges in an undirected graph. Provide code or detailed pseudocode, explain the discovery time and low-link values concept, and state the time complexity.

Unlock Full Question Bank

Get access to hundreds of Algorithms and Data Structures interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.