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.

HardTechnical
84 practiced
Discuss lock-free concurrent data structures (for example the Michael & Scott queue) and their applicability on mobile platforms. Explain pros and cons vs mutex-based designs considering ARM weak memory ordering, energy usage, code complexity, and debugging difficulty. Describe safe memory reclamation strategies (hazard pointers, epoch-based reclamation) required for lock-free lists/queues and provide pseudocode for enqueue/dequeue with complexity analysis.
EasyTechnical
99 practiced
Compare adjacency list and adjacency matrix representations for graphs. For a mobile app that processes social-graph data of up to 50k users with average degree 10, which representation would you choose and why? Discuss time/space trade-offs and cache/IO considerations for queries like "friends-of-friends" or short-path computations.
MediumTechnical
84 practiced
A shared in-memory LRU cache is accessed by background threads and the UI thread concurrently. On Android/Kotlin or iOS/Swift, what synchronization strategy would you choose to make get/put thread-safe while minimizing contention and UI latency? Compare coarse-grained locking, fine-grained locking, read-write locks, and lock-free techniques. Mention platform primitives (synchronized/ReentrantLock, ConcurrentHashMap, DispatchQueue) and their trade-offs for battery and responsiveness.
EasyTechnical
88 practiced
You must display a long, scrollable feed in Android (RecyclerView) or iOS (UITableView). What in-memory data structure(s) would you use to back the adapter and why? Discuss trade-offs between arrays, linked lists, trees, and immutable snapshots when it comes to random access, insert/delete patterns, diffing updates, memory usage, and responsiveness of UI updates.
MediumTechnical
92 practiced
Describe how a Bloom filter can be used in a mobile app to test whether a user has seen a content item before without storing all IDs. Explain false positive trade-offs, how to choose bit-array size m and number of hash functions k for expected n items and a target false positive rate p, and strategies to persist and update the filter safely across restarts while keeping memory usage low.

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.