18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Lecture 17 - minimum spanning trees<br />

merge two sets together. <strong>The</strong>se can be implemented by UNION and FIND operations:<br />

Is<br />

Make<br />

t= Find<br />

u= Find<br />

Return (Is t=u?)<br />

Union(t, u)<br />

Find returns the name of the set and Union sets the members of t to have the same name as u.<br />

We are interested in minimizing the time it takes to execute any sequence of unions and finds.<br />

A simple implementation is to represent each set as a tree, with pointers from a node to its parent. Each<br />

element is contained in a node, and the name of the set is the key at the root:<br />

Listen To Part 19-7<br />

file:///E|/LEC/LECTUR16/NODE17.HTM (8 of 11) [19/1/2003 1:35:14]

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

Saved successfully!

Ooh no, something went wrong!