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
102 practiced
Explain the common time complexity classes: O(1), O(log n), O(n), O(n log n), O(n^2), and O(2^n). For each class give a concrete frontend example (for example: DOM lookup, binary search on sorted data, rendering N list items, sorting visible rows, nested layout loops, exhaustive combinatorial checks) and explain when a frontend developer should be concerned about that complexity in production web apps.
EasyTechnical
94 practiced
Compare adjacency list and adjacency matrix as graph representations. For a frontend use-case like representing UI transitions, module dependencies, or social graphs, discuss the memory/time trade-offs for sparse vs dense graphs and complexity for traversal, edge lookup, and adding/removing edges.
MediumTechnical
69 practiced
Write a debounce function in JavaScript: debounce(fn, wait, immediate = false). Your implementation should support cancelation and describe how debouncing reduces frequency of calls. Analyze time and space complexity and explain differences between debounce and throttle and when each is appropriate in UI event handling.
HardTechnical
90 practiced
Design an undo/redo system for a complex web editor that supports large documents and many operation types (insert, delete, style, composition). Compare snapshot-based vs command-based models. Propose data structures (command logs, inverse ops, checkpoint snapshots, compressed deltas), explain time complexity for apply/undo, and describe strategies to minimize memory while keeping undo latency low.
EasyTechnical
95 practiced
Explain amortized time complexity for pushing elements into a dynamic array (as commonly used in JavaScript). Describe the doubling (or growth-factor) strategy, why occasional push operations can take O(n), and why the amortized cost per push is O(1). Include memory overhead trade-offs with different growth factors.

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.