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.

MediumTechnical
39 practiced
Given a long stream of tokens that must be windowed for online feature extraction, explain how you would implement efficient sliding-window counts (or maxima/minima) using appropriate queue(s), and how to evict old elements, handle out-of-order arrivals, and memory bounds.
EasyTechnical
40 practiced
In Python, implement a simple SinglyLinkedList class supporting: insert_head(value), remove_head(), and to_list() for testing. Ensure your implementation correctly handles empty lists, updates head and tail as needed, and runs insert_head in O(1) time. Show Node structure in your answer.
EasyTechnical
70 practiced
Given two sorted singly linked lists, write a function to merge them into a single sorted list in-place (reuse nodes, no new allocations). Implement in Python or Java and explain how you maintain O(1) extra space and O(n) time.
EasyTechnical
39 practiced
Describe a circular buffer (ring buffer) for implementing a fixed-capacity queue. Explain how you detect full vs empty, and write enqueue/dequeue pseudo-code in C++ that avoids moving elements and runs in O(1) time.
EasyTechnical
39 practiced
Given a singly linked list, implement a function to return the middle node. For even-length lists return the second of the two middle nodes. Write code (in Python or Java) and explain why your approach is O(n) time and O(1) space using two pointers (fast and slow).

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.