Linked Lists, Stacks, and Queues Questions

Pointer-based linear structures and the classic problems built on them: singly, doubly and circular linked lists (reversal whole, partial and in groups of k, cycle detection and cycle start with fast/slow pointers, intersection, middle and nth-from-end, merging two or k sorted lists, sorting a list, reordering, palindrome check, rotation, partitioning, duplicate removal, deep copy with random pointers, flattening child lists, sentinel nodes), implementing lists in C, C++ and Rust with attention to pointer handling, ownership and cleanup, array versus linked-list trade-offs including cache locality, stacks, queues and deques (array, linked and circular-buffer implementations, ring-buffer full versus empty, queue from two stacks, min stack, round-robin scheduling), monotonic stacks and queues (next greater element, largest rectangle in a histogram, sliding-window maximum), stack-based expression and bracket evaluation (balanced brackets, Reverse Polish Notation, infix to postfix, calculators), and structure-level builds such as an LRU cache from a hash map plus doubly linked list, undo/redo history, and variants like persistent or unrolled lists. Foundational for coding interviews and for understanding how higher-level structures are built. Concurrent and lock-free queues, memory allocators, general graph traversal, heaps and cache-eviction system design are covered elsewhere.

MediumTechnical
36 practiced

Determine whether a singly linked list is a palindrome in O(n) time and O(1) extra space. If you modify the list, restore it before returning.

EasyTechnical
47 practiced

When would you build a stack or a queue on an array (or dynamic array) versus a linked list? Compare memory locality, resizing, worst-case versus amortized operation cost, and in Python the practical choice between a list and collections.deque.

EasyTechnical
48 practiced

Implement a stack on top of a dynamic array with push, pop, peek, is_empty and size. Push and pop must be O(1) amortized, and pop on an empty stack must raise a clear error. Also show how you would support a fixed maximum capacity.

EasyTechnical
36 practiced

What are the differences between a stack and a queue? Give at least four realistic software uses of each and explain why that structure is the right fit.

EasyTechnical
41 practiced

Implement a stack using a singly linked list with push, pop, peek, is_empty and size, all O(1). Compare the memory use and speed against an array-backed stack.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.