Stack matching
Validate nested symbols
Use a stack to validate parentheses, brackets, and braces while rejecting mismatched or unfinished groups.
Advanced Topics in Computer Science
Students study abstract data types that control access order: last-in-first-out stacks and first-in-first-out queues.
Unit Focus
The unit connects ADTs to practical applications like undo history, expression evaluation, simulations, and breadth-first search.
Practice Work
Build a balanced-symbol checker and postfix expression evaluator.
Model a service line simulation using queues and runtime statistics.
DSA Assignment Bank
Code Scholars provides structured assignments, implementation support, edge-case review, and runtime analysis coaching so students learn the concept rather than only memorizing a solution.
Stack matching
Use a stack to validate parentheses, brackets, and braces while rejecting mismatched or unfinished groups.
Stack evaluation
Process a postfix expression with numbers and operators, pushing operands and applying operations in the correct order.
Operator precedence stack
Use a stack to handle precedence and grouping while converting an infix expression to postfix form.
Auxiliary stack
Support push, pop, top, and getMin in constant time by tracking minimum values alongside the main stack.
ADT conversion
Use two stacks so enqueue and dequeue behave like a FIFO queue and analyze amortized cost.
ADT conversion
Use one or two queues so push and pop behave like a LIFO stack.
Two stacks
Model back and forward navigation with two stacks and explain what happens after visiting a new page.
Stack cleanup
Process path tokens, handling current directory, parent directory, and repeated separators safely.
Monotonic stack
For each value in an array, find the next value to its right that is greater.
Monotonic stack
Given daily measurements, compute how many days until a larger measurement appears.
Monotonic stack
Use a stack of increasing bar indices to compute the largest rectangle area in a histogram.
Deque
Maintain candidate indices in a deque to report the maximum value in each fixed-size window.
Queue plus counts
Process a stream of characters and report the first character that has appeared exactly once after each update.
Queue simulation
Simulate tasks that receive fixed time slices until complete and report completion order.
Queue simulation
Track arrivals, service durations, wait times, and maximum queue length in a service-line model.
Queue traversal
Use a queue to visit tree nodes level by level and group values by depth.
BFS queue
Use a queue to find the minimum number of moves from a start cell to a target cell.
Two stacks
Model text editor undo and redo behavior while clearing redo history after a new edit.
Stack parsing
Decode a compact repeated-string notation using stacks for counts and partial strings.
Simulation
Given a push order and proposed pop order, simulate stack operations to determine whether the pop order is possible.
Array-backed queue
Implement enqueue and dequeue with front, size, and wraparound arithmetic.
Double-ended queue
Support insert and delete at both ends with wraparound and capacity checks.
Stack compression
Process a string and remove groups of k adjacent equal characters until no such group remains.
Monotonic stack
For each price, compute how many consecutive previous prices are less than or equal to it.
Queue discipline
Compare FIFO, stack, and priority behavior for tasks with arrival times and urgency values.
Queue and stack
Reverse only the first k items of a queue while preserving the order of the remaining items.
Queue rearrangement
Given an even-length queue, interleave the first half and second half while preserving each half order.
Stack reasoning
Given function entry and exit events, determine whether the trace could come from a valid call stack.
ADT selection
Given several scenarios, choose stack, queue, or deque and explain how access order drives the choice.
DSA support
Create an assignment with implementation, simulation, edge cases, and a written comparison of stack and queue behavior.
Work through the concepts, code, edge cases, and runtime analysis with 1:1 guidance.