DSA · INTERVIEW & OA PREP

Topic 3 of 12

Linked Lists, Stacks & Queues

Pointer-manipulation problems separate people who memorise from people who understand references. Stacks and queues underpin traversal, parsing, and scheduling questions that show up in both OAs and interviews.

Key concepts

  • Fast/slow pointers detect cycles and find the middle of a list.
  • Reversing a linked list in place — the classic pointer-rewiring drill.
  • Stack (LIFO) for matching brackets, undo, and monotonic-stack problems.
  • Queue (FIFO) for BFS and level-order traversal.

Questions that get asked

  • Reverse a linked list (iterative and recursive).
  • Detect a cycle in a linked list (Floyd's algorithm).
  • Merge two sorted linked lists.
  • Valid parentheses using a stack.
  • Implement a queue using two stacks.
Tip

Draw the nodes and arrows on paper (or the whiteboard) before writing pointer code — it prevents lost-reference bugs.

Common mistake

Losing the rest of the list by reassigning next before saving it. Always cache the next node first.

Quick checks

Three tap-only questions to test your recall on this topic.

Keep going

Ready to apply? Browse live internships and sharpen your resume first.