15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

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.

Corollary 399 A fully balanced tree of depth d has 2 d+1 − 1 nodes.<br />

Proof:<br />

P.1 Let G := 〈V, E〉 be a fully balanced tree<br />

Then #(V ) = d<br />

i=1 2i = 2 d+1 − 1.<br />

c○: Michael Kohlhase 230<br />

This shows that balanced binary trees grow in breadth very quickly, a consequence of this is that<br />

they are very shallow (and this compute very fast), which is the essence of the next result.<br />

Depth Lemma for Balanced Trees<br />

P.2 Lemma 400 Let G = 〈V, E〉 be a balanced binary tree, then dp(G) = ⌊log 2(#(V ))⌋.<br />

Proof: by calculation<br />

P.1 Let V ′ := V \W , where W is the set of nodes at level d = dp(G)<br />

P.2 By the size lemma, #(V ′ ) = 2 d−1+1 − 1 = 2 d − 1<br />

P.3 then #(V ) = 2 d − 1 + k, where k = #(W ) and (1 ≤ k ≤ 2 d )<br />

P.4 so #(V ) = c · 2 d where c ∈ R and 1≤c

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

Saved successfully!

Ooh no, something went wrong!