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 8 - binary trees<br />

If it does not have a left child, a node's predecessor is its first left ancestor.<br />

<strong>The</strong> proof of correctness comes from looking at the in-order traversal of the tree.<br />

Tree-Successor(x)<br />

if<br />

then return Tree-Minimum(right[x])<br />

while and (x = right[y])<br />

return y<br />

Tree predecessor/successor both run in time proportional to the height of the tree.<br />

Listen To Part 8-9<br />

do<br />

file:///E|/LEC/LECTUR17/NODE8.HTM (5 of 13) [19/1/2003 1:34:46]<br />

In-Order Traversal

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

Saved successfully!

Ooh no, something went wrong!