InterviewStack.io LogoInterviewStack.io

Linked Lists, Stacks, and Queues Questions

Pointer-based linear structures: singly and doubly linked lists, stacks, queues, and deques. Covers pointer manipulation, cycle detection, reversal, and using LIFO/FIFO ordering to model traversal, undo, and scheduling problems. Foundational for both interview problems and understanding how higher-level structures are built.

HardTechnical
50 practiced

Implement a memory-safe doubly linked list in modern C++ that uses RAII and smart pointers. Choose an ownership model (for example unique_ptr for next and raw/weak pointer for prev) and implement insert and remove operations ensuring no memory leaks or dangling pointers.

HardTechnical
39 practiced

Analyze and compare cache and CPU locality effects for traversing a large array versus traversing a large linked list. Explain why linked list pointer-chasing can be slow on modern CPUs and propose practical techniques (e.g., node pooling, memory slab allocation, cache-aligned nodes) to improve locality and performance in real systems.

MediumTechnical
49 practiced

Design and implement a MinStack in Python that supports push(x), pop(), top(), and getMin() each in O(1) time. Provide two approaches: auxiliary stack of minimums and value encoding trick. Explain space complexity and handling of duplicates.

HardTechnical
44 practiced

Explain why a naive recursive linked list reversal uses O(n) stack space and discuss how tail recursion or iterative conversion can reduce space. In languages with limited tail-call optimization (like Java/C++), what practical techniques can you use to avoid stack overflow for very long lists?

EasyTechnical
35 practiced

Explain the amortized time complexity argument for push on a dynamic array used to implement a stack, and for enqueue/dequeue operations on a circular buffer queue. Provide an intuitive explanation using the doubling strategy and compare worst-case vs amortized costs and memory trade-offs.

Unlock Full Question Bank

Get access to all Linked Lists, Stacks, and Queues interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.