08.06.2015 Views

A Simple and Efficient Union-Find-Delete Algorithm - Corelab

A Simple and Efficient Union-Find-Delete Algorithm - Corelab

A Simple and Efficient Union-Find-Delete Algorithm - Corelab

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.

Implementing <strong>Find</strong><br />

• Instead of path compression we use path<br />

splitting [Tarjan <strong>and</strong> van Leeuwen]<br />

• Each node in the path is moved from its<br />

parent to its gr<strong>and</strong>-parent<br />

• If the parent now has less than three children<br />

we move them as well<br />

0<br />

7<br />

1<br />

9<br />

5 2 3 8 4<br />

6

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

Saved successfully!

Ooh no, something went wrong!