InterviewStack.io LogoInterviewStack.io

Linked Lists, Stacks, and Queues Questions

Pointer-based linear structures: singly and doubly linked lists, stacks, queues, and deques. Covers pointer manipulation, cycle detection, reversal, and using LIFO/FIFO ordering to model traversal, undo, and scheduling problems. Foundational for both interview problems and understanding how higher-level structures are built.

HardTechnical
39 practiced

Describe and sketch a lock-free implementation for insert and delete in a singly linked list suitable for a high-throughput backend component. Use atomic compare-and-swap primitives and explain how you will handle the ABA problem and safe memory reclamation in C++ (for example hazard pointers or epoch-based reclamation). Provide pseudocode for insert and delete.

EasyTechnical
47 practiced

Discuss the algorithmic complexity and trade-offs of converting a contiguous array to a singly linked list and vice versa in backend systems. Cover time complexity, memory overhead, cache behavior, and situations where converting is beneficial or harmful, such as streaming processing, adjacency lists, or free lists.

MediumTechnical
43 practiced

Describe and compare two algorithms for merging k sorted singly linked lists into one sorted list in a backend service: using a min-heap and using divide-and-conquer. Provide pseudocode, analyze time and space complexity in terms of total number of nodes N and number of lists k, and discuss memory and performance trade-offs for server environments.

EasyTechnical
40 practiced

Implement a C function that returns the middle node of a singly linked list. For even-length lists, choose whether to return the first middle or second middle, state your choice, and implement accordingly. Use 'struct Node { int val; struct Node* next; };' and justify your approach for backend algorithms.

HardSystem Design
46 practiced

Design a memory allocator component for a backend system that uses free lists to serve small allocations. Discuss block size classes (segregated free lists), alignment, block headers, how to coalesce adjacent free blocks, and strategies to minimize fragmentation and lock contention. Sketch interfaces and explain how linked lists are used for free blocks.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.