InterviewStack.io LogoInterviewStack.io

Data Structure Selection and Trade Offs Questions

Skill in selecting appropriate data structures and algorithmic approaches for practical problems and performance constraints. Candidates should demonstrate how to choose between arrays lists maps sets trees heaps and specialized structures based on access patterns memory and CPU requirements and concurrency considerations. Coverage includes case based selection for domain specific systems such as games inventory or spatial indexing where structures like quadtrees or spatial hashing are appropriate, and language specific considerations such as value versus reference types or object pooling. Emphasis is on explaining rationale trade offs and expected performance implications in concrete scenarios.

EasyTechnical
79 practiced
In Python ML code, compare Python lists (list of tuples/dicts) and numpy.ndarray for storing numeric features and minibatches. Discuss memory layout, value vs reference semantics, performance of vectorized operations versus Python-level loops, impact on transferring data to GPU, and when to convert or keep data in each form during training or inference.
MediumTechnical
120 practiced
Compare row-oriented (row-major) vs columnar (column-major like Parquet/Arrow) storage for feature stores and offline training pipelines. Discuss IO patterns, compression benefits, vectorized processing, and how each affects training pipelines that read many features for many examples vs a few features for many examples.
HardSystem Design
58 practiced
Design an on-disk inverted index for textual features used in a retrieval/feature extraction pipeline. Describe postings list representation, compression (e.g., delta-encoding, variable-byte, PForDelta), support for prefix queries, merging updates efficiently, and trade-offs between memory-mapped files and explicit IO and caching.
HardSystem Design
79 practiced
Design an ANN retrieval system at billion-scale vectors with limited RAM. Discuss combining product quantization (PQ), inverted file (IVF) indexing, and disk-backed retrieval (SSD) while keeping recall high and latency low. Include strategies for index sharding, caching of centroids/quantized codes, and offline/online re-ranking.
MediumTechnical
61 practiced
Discuss tensor memory layouts (row-major vs column-major, contiguous vs strided/noncontiguous) and how they affect batching, transposes, and GPU/kernel performance. Provide guidance on when to enforce contiguity, when to prefer channels-first vs channels-last for conv nets, and how to avoid expensive copies before GPU ops.

Unlock Full Question Bank

Get access to hundreds of Data Structure Selection and Trade Offs interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.