17.10.2014 Views

Chapter 3: Optimal Trees and Branchings - UKP

Chapter 3: Optimal Trees and Branchings - UKP

Chapter 3: Optimal Trees and Branchings - UKP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Optimal</strong> <strong>Trees</strong> <strong>and</strong> <strong>Branchings</strong><br />

Priority queues<br />

A priority queue Q is an abstract data structure managing a set of objects of type T .<br />

Every element in Q has a key of an ordered number type NT (N, Z, ...)<br />

A priority queue supports the following operations:<br />

void create-pq(): create an empty priority queue Q<br />

void insert(T & x, NT y): insert the element x with key value y = key[x] into Q.<br />

T& find-min(): find the element x with the lowest key value <strong>and</strong> return reference to it.<br />

void delete-min(): remove the element with smallest key value from Q.<br />

void decrease-key(T x, NT y): decrease the key value of x to the new value Wert y.<br />

(Precondition: key[x] > y)<br />

bool empty(): returns TRUE if Q is empty.<br />

Annotation: Analogously, the data structure might deliver the element with the largest key value.<br />

Efficient Graph Algorithms | Wolfgang Stille | WS 2011/2012 | <strong>Chapter</strong> III - <strong>Optimal</strong> <strong>Trees</strong> <strong>and</strong> <strong>Branchings</strong> | 33

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!