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.

HardTechnical
0 practiced
Given two singly linked lists that may independently contain cycles, design an algorithm to determine whether they intersect (share a node by reference) and if so return the first intersecting node encountered along their traversal. Handle these cases: both acyclic, both cyclic, and one cyclic one acyclic. Describe all steps and analyze complexity.
EasyTechnical
0 practiced
Describe how a circular buffer (ring buffer) queue works using an array of fixed capacity. Explain how you compute the next index with modulo arithmetic, how you detect full and empty states, and two practical ways to disambiguate full vs empty (maintain count, or leave one slot unused). Discuss advantages and common pitfalls.
EasyTechnical
0 practiced
Implement a Stack using a singly linked list in JavaScript. Provide methods push(value), pop(), peek(), isEmpty(), and size(). Ensure all operations are O(1), handle underflow properly, and include short usage examples.
HardTechnical
0 practiced
Reverse nodes of a linked list k at a time. Given a linked list and integer k, reverse the nodes of the list k at a time and return its modified list. If the number of nodes is not a multiple of k then leave the last nodes as is. Implement in-place with O(1) extra memory. Example: list 1->2->3->4->5 and k=2 returns 2->1->4->3->5.
MediumTechnical
0 practiced
Detect whether a singly linked list has a cycle. Implement Floyd's cycle-finding algorithm (tortoise and hare) and then extend it to return the node at the start of the cycle if one exists. Provide code and explain the reasoning behind finding the cycle entry.

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.