Lecture Notes for SE 598, Data Structures and Algorithms
28 June 2000, Dequeue Algorithms
- dequeue structure
- sequential - linear; value after another
- limited access - enter at the end, leave at the beginning
- values can enter and leave a dequeue at either end
- queues are order preserving; values leave in the same order they
arrived
- first in, first out - fifo; strict queue order
- longest waiting next
- dequeue algorithms
- breadth-first searches
- traversing a graph, visiting each node once
- start at city A and look the shortest way to get to city B
- at each node, how to rembmer the nodes to visit next
- use a queue to store the to-be-visited nodes
- the tranversal spreads out in rings around the initial node -
breadth-first search
- buffering between independently executing components
- a produce makes things used by a consumer
- a web browser sending requests to a http server
- what happens when one side is faster than the other
- use a buffer to store the things made by the producer but not yet
used by the consumer
- doesn't work on its own if the difference in speed is too great
- producers and consumers of similar speed, a queue capable of holding
two things is enough
- most buffers are strictly bounded
- re-ordering queue components - priority queues
- some things are more important than others and should jump the queue
- background (or batch) processes vs. foreground (or interactive)
processes
- how to re-order the queue so that the next most important, rather
than the longest waiting, comes next
- this requires a speical data structure called the priority queue
This page last modified on 26 June 2000.