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.

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.

EasyTechnical
44 practiced

In Node.js (JavaScript), implement a function that removes and returns the nth node from the end of a singly linked list in a single pass. Use the list node structure 'function ListNode(val) { this.val = val; this.next = null; }'. Handle edge cases where n equals the list length, n is 1, and invalid n values.

EasyTechnical
42 practiced

Write a function in Python that reverses a singly linked list in place and returns the new head. Node is 'class ListNode: def init(self, val=0, next=None): ...'. Your algorithm should be iterative, run in O(n) time and O(1) extra space. Mention how you handle empty and single-node lists.

HardTechnical
36 practiced

For backend services processing large linked data structures, explain strategies to minimize memory overhead and improve cache locality for linked lists: block allocation, pooling, array-of-structs, struct-of-arrays, pointer compression, packed nodes, and trade-offs between pointer-based lists and contiguous arrays or CSR representations.

MediumTechnical
36 practiced

Implement in Java a function that partitions a singly linked list around value x such that nodes less than x come before nodes greater or equal to x, preserving original relative order within each partition. Use O(1) extra space and a single pass. Provide time and space complexity.

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.