[prev] 3 [next]

Stacks, Queues, PriorityQs (cont)

All of these data structures have
  • a sequence of items
  • an operation to insert an item into the sequence
  • an operation to remove an item from the sequence
Data structures differ in
  • stack ... insert adds on top,  removes from top
  • queue ... insert adds at tail,  removes from head
  • priorityQ ... inserts item with a given priority,  removes item with highest priority