InterviewStack.io LogoInterviewStack.io

Linked Lists Stacks and Queues Questions

Covers core singly and doubly linked list concepts and the fundamental abstract data types stack and queue. For linked lists this includes node structure, traversal, insertion at head and tail, deletion, reversal, finding middle, merging, detecting cycles, removing duplicates, intersection detection, and pointer manipulation details for languages with manual memory management. For stacks and queues this includes LIFO and FIFO semantics, push, pop, peek, enqueue, dequeue, circular buffer implementations, and implementing one with the other (for example queue with two stacks). Also includes array versus linked list implementations, complexity analysis for time and space, and common algorithmic patterns that use these structures (for example bracket matching, reverse polish notation evaluation, depth first search using a stack, breadth first search using a queue, sliding window and monotonic queue techniques). Interviewers assess correct implementation, edge case handling, performance tradeoffs, and ability to choose the appropriate structure or approach for a problem.

EasyTechnical
0 practiced
Implement a Stack class in Python with push(x), pop(), peek(), and is_empty() using an underlying Python list but enforce a maximum capacity passed at construction. All operations must be O(1) and raise meaningful exceptions on overflow/underflow. Include short examples of usage.
MediumTechnical
0 practiced
Given a set of tasks forming a DAG, implement topological sort using Kahn's algorithm (queue-based) and explain how this compares to DFS-based stack approach. Provide code and discuss when you would prefer one approach in model compilation or task scheduling.
EasyTechnical
0 practiced
Implement a function to evaluate a Reverse Polish Notation (postfix) expression containing integers and operators (+,-,*,/). Use a stack and return the integer result. Provide code in Python and include error handling for malformed expressions.
MediumTechnical
0 practiced
Implement a queue using two stacks such that both enqueue and dequeue are amortized O(1). Provide Python code and explain an adversarial sequence that causes worst-case O(n) for a single operation but amortized O(1) overall.
HardTechnical
0 practiced
Implement a lock-free single-producer single-consumer ring buffer for zero-copy transfer of minibatches from data loader thread to GPU transfer thread. Provide C++ pseudo-code highlighting head/tail semantics, memory_order constraints for atomics, and explain how to avoid ABA problems.

Unlock Full Question Bank

Get access to hundreds of Linked Lists Stacks and Queues interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.