Lecture Notes for SE 598, Data Structures and Algorithms
28 June 2000, Dequeue Applications
- simulations
- an entity obtains some service from a station
- a station can service only one entity at a time, others must wait in a
queue
- a system is an interconnection (a graph) of queues and stations
- statistical properties determine how often an entity arrives at a
station for service, and how long it takes to service an entity
- the objective is to find overall properties of the system - how many
entities services per unit time, the longest wait for service, and so
on
- closed form equations for even simple systems are usually impossible,
so we simulate with programs
- packet routers
- a router has connections to two or more networks
- an packet enters a(n internal) router and is sent out via another
network
- only one packet can exit a network at a time; extra packets must wait
in a queue
- routers usually have several queues, and queues are bounded
- queue management is an important aspect of router design
- radix sorting - punch card sorting
- sort a list of numbers - zip codes, for example.
- set up a vector of ten queues, initially empty
- let the rightmost digit in a number (the ones digit) be the first
digit, other digits are numbered increasing by one to the left
- numbers with fewer digits than others are padded to the left with
zeros; assume all numbers have n digits.
- sort as follows:
- if the first digit of number i is d, put i in queue
d; repeat for all numbers
- empty each queue 0 through 9 in order into a new queue
- repeat with the second digit
- repeat for all digits
This page last modified on 27 June 2000.