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
38 practiced
When implementing a linked list in C, describe the pointer-manipulation steps and necessary checks for inserting and deleting nodes safely. Provide short code-like pseudocode for insert after a given node and delete a given node, and discuss common bugs such as dangling pointers, double free, and null dereference. Mention best practices to avoid these issues.
EasyTechnical
40 practiced
In Java, implement a minimal singly linked list class with a Node inner class and a method insertAtHead(value) that inserts a new node at the head. Ensure you handle an initially empty list, maintain list size, and provide a toString method that prints nodes in order. Discuss time complexity and edge cases.
HardTechnical
40 practiced
Implement an arithmetic expression parser and evaluator that supports integers, parentheses, binary operators + - * /, operator precedence and associativity, and unary plus/minus. Use the shunting-yard algorithm or operator and operand stacks. Provide code or detailed design, and show how you handle errors and whitespace.
MediumTechnical
66 practiced
Design and implement a bounded blocking queue class in Java for producer-consumer use. Your API should include enqueue(item) and dequeue() that block when the queue is full or empty respectively. Describe behavior on thread interruption, fairness options, and how to implement using wait/notify or Lock and Condition.
MediumTechnical
44 practiced
Evaluate Reverse Polish Notation expressions using a stack. Implement an evaluator in Java that supports integers, +, -, *, / and handles division truncation the same way integer division in Java does. Example: tokens = ['2', '1', '+', '3', '*'] should return 9. Include error handling for malformed expressions.

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.