InterviewStack.io LogoInterviewStack.io

Data Structures and Complexity Questions

Comprehensive coverage of fundamental data structures, their operations, implementation trade offs, and algorithmic uses. Candidates should know arrays and strings including dynamic array amortized behavior and memory layout differences, linked lists, stacks, queues, hash tables and collision handling, sets, trees including binary search trees and balanced trees, tries, heaps as priority queues, and graph representations such as adjacency lists and adjacency matrices. Understand typical operations and costs for access, insertion, deletion, lookup, and traversal and be able to analyze asymptotic time and auxiliary space complexity using Big O notation including constant, logarithmic, linear, linearithmic, quadratic, and exponential classes as well as average case, worst case, and amortized behaviors. Be able to read code or pseudocode and derive time and space complexity, identify performance bottlenecks, and propose alternative data structures or algorithmic approaches to improve performance. Know common algorithmic patterns that interact with these structures such as traversal strategies, searching and sorting, two pointer and sliding window techniques, divide and conquer, recursion, dynamic programming, greedy methods, and priority processing, and when to combine structures for efficiency for example using a heap with a hash map for index tracking. Implementation focused skills include writing or partially implementing core operations, discussing language specific considerations such as contiguous versus non contiguous memory and pointer or manual memory management when applicable, and explaining space time trade offs and cache or memory behavior. Interview expectations vary by level from selecting and implementing appropriate structures for routine problems at junior levels to optimizing naive solutions, designing custom structures for constraints, and reasoning about amortized, average case, and concurrency implications at senior levels.

EasyTechnical
146 practiced
Describe the main collision resolution strategies for hash tables: separate chaining, open addressing (linear/quadratic probing), and double hashing. For each, explain average-case and worst-case time complexities for search/insert/delete, memory overhead, deletion handling, and practical cache behavior.
EasyTechnical
72 practiced
List the typical operation costs for an unbalanced binary search tree (BST) and for balanced BSTs (AVL, red-black). Explain why tree height matters, how rotations impact insert/delete complexity, and give scenarios where an unbalanced BST may be acceptable in practice.
MediumTechnical
89 practiced
Implement an LRU cache class in Python with methods get(key) and put(key, value) operating in O(1) time and a fixed capacity. Provide code or clear pseudocode, explain memory trade-offs, and discuss how you would adapt the design for sharded or concurrent environments used in research prototypes.
HardSystem Design
76 practiced
Design a concurrent lock-free priority queue suitable for multi-producer, multi-consumer workloads in a research experiment. Describe the underlying data structures (heap-based, skiplist-based, or multi-queue), how linearizability is achieved, what progress guarantees you aim for (lock-free/wait-free), how you handle memory reclamation, and provide complexity estimates for common operations.
EasyTechnical
100 practiced
Compare arrays (contiguous memory) and singly linked lists (pointer-based) for random access, insertion, deletion, and traversal. Discuss space overhead, cache locality and prefetch benefits, pointer-chasing penalties, and language-specific considerations in managed runtimes versus manual memory management.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.