Stack and Queue

Learn stack and queue implementations before practising conversions, expression problems and monotonic-stack applications.

8 online
Overall Progress
PLUS – Videos, editorials, planner all in one place – Videos, editorials, personalised planner & TUFY all in one place to save your time.

Planly

Know more

Striver’s Stacks and Queues Sheet contains 30 coding questions. It retains the original 26-question selection and restores four basic implementations: stacks and queues using arrays and using linked lists. These operations now have a place before conversions, expression problems and monotonic-stack applications.

Striver’s Stack and Queue Sheet contains 26 problems on structure design, parenthesis matching, expression conversion, monotonic boundaries, simulations, deque windows and caches. The range helps you connect simple operations with applications that maintain several pieces of state. A stack may hold indices, values or partial expressions; the choice must follow the required answer.

Use each attempt to explain why an item can be removed permanently or must remain available. For nearest-element questions, that explanation concerns future candidates. For a cache, it concerns lookup and eviction state. For an expression, it concerns grouping and operand order. Naming the container is a starting point, rather than the complete solution.

Topics covered in this practice sheet

The implementation questions establish insertion, removal, access to the next value and empty-state handling. The later questions combine those operations in conversions between data structures, expression evaluation or ordering rules. Monotonic-stack and queue questions additionally need a clear reason for removing a stored candidate.

  • Stack and queue implementations using arrays and linked lists.
  • Conversions and expression-related coding questions.
  • Monotonic-stack or queue applications from the retained interview selection.

Beginner lessons and prerequisites

The existing implementation lesson explains how stacks and queues can be built using different data structures. Know arrays, indices, functions and linked list links before implementing the corresponding version. Understand last-in-first-out and first-in-first-out order before using either structure inside a larger algorithm.

Know push, pop, top or front, and empty checks. Understand that a deque permits updates at both ends, but its operations do not automatically establish a monotonic order. Be comfortable with indices when the answer involves a distance, a width or whether a candidate is still inside a window.

For expression conversion, separate precedence from associativity and check whether operands are single symbols or complete tokens. Subtraction is a useful test because reversing its operands changes the answer. For cache design, understand hash lookup and doubly linked updates before combining them with eviction rules. A fast lookup alone does not guarantee a fast complete operation.