12.07.2015 Views

Heap sort and complexity, Disjoint Union & Find, Complexity ...

Heap sort and complexity, Disjoint Union & Find, Complexity ...

Heap sort and complexity, Disjoint Union & Find, Complexity ...

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.

Chapter 2: Elementary Data Structures1 2 n 23 n 24nInitially1UNION(1,2)1 3UNION(FIND(1),3)25n2UNION(FIND(n-1),n)UNION(FIND(3),4)1 3 41 3 4 nIn order to implement the weighting rule, we need to knowhow many nodes are there in a tree. We maintain a COUNTfield in the root of every tree.

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

Saved successfully!

Ooh no, something went wrong!