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.

Therefore we look at special configurations for combinatory circuits that have good depth and cost.<br />

These will become important, when we build actual combinational circuits with given input/output<br />

behavior.<br />

Balanced Binary Trees<br />

Balanced Binary Trees<br />

Definition 395 (Binary Tree) A binary tree is a tree where all nodes have out-degree 2<br />

or 0.<br />

Definition 396 A binary tree G is called balanced iff the depth of all leaves differs by at<br />

most by 1, and fully balanced, iff the depth difference is 0.<br />

Constructing a binary tree Gbbt = 〈V, E〉 with n leaves<br />

step 1: select some u ∈ V as root, (V1 := {u}, E1 := ∅)<br />

step 2: select v, w ∈ V not yet in Gbbt and add them, (Vi = Vi−1 ∪ {v, w})<br />

step 3: add two edges 〈u, v〉 and 〈u, w〉 where u is the leftmost of the shallowest nodes<br />

with outdeg(u) = 0, (Ei := Ei−1 ∪ {〈u, v〉, 〈u, w〉})<br />

repeat steps 2 and 3 until i = n (V = Vn, E = En)<br />

Example 397 7 leaves<br />

c○: Michael Kohlhase 229<br />

We will now establish a few properties of these balanced binary trees that show that they are good<br />

building blocks for combinatory circuits.<br />

Size Lemma for Balanced Trees<br />

Lemma 398 Let G = 〈V, E〉 be a balanced binary tree of depth n > i, then the set<br />

Vi := {v ∈ V | dp(v) = i} of nodes at depth i has cardinality 2 i .<br />

Proof: via induction over the depth i.<br />

P.1 We have to consider two cases<br />

P.1.1 i = 0:<br />

then Vi = {vr}, where vr is the root, so #(V0) = #({vr}) = 1 = 2 0 .<br />

P.1.2 i > 0:<br />

then Vi−1 contains 2 i−1 vertices (IH)<br />

P.1.2.2 By the definition of a binary tree, each v ∈ Vi−1 is a leaf or has two children that<br />

are at depth i.<br />

P.1.2.3 As G is balanced and dp(G) = n > i, Vi−1 cannot contain leaves.<br />

P.1.2.4 Thus #(Vi) = 2 · #(Vi−1) = 2 · 2 i−1 = 2 i .<br />

125

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

Saved successfully!

Ooh no, something went wrong!