JEDI Slides-DataSt-Chapter03-Queues
JEDI Slides-DataSt-Chapter03-Queues
/* Delete an item */
Object dequeue() throws QueueException;
}
Irreflexivity : x ≺ x
Asymmetry x ≺ y then
: DataifStructures y≺x
– Queues 15
Transitivity : if x ≺ y and y ≺ z, then x ≺ z
Application: Topological Sorting
The Problem
Remarks:
If the input satisfies partial ordering, then the algorithm will terminate when the
queue is empty
If a loop exists, it will also terminate but will not output the elements in the loop.
Instead, it will just inform the user that a loop is present