Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Binomial Trees

A binomial tree is a general tree with a very special shape:

Definition (Binomial Tree)  The binomial tree of order tex2html_wrap_inline60398 with root R is the tree tex2html_wrap_inline65448 defined as follows
  1. If k=0, tex2html_wrap_inline65452. That is, the binomial tree of order zero consists of a single node, R.
  2. If k>0, tex2html_wrap_inline65458. That is, the binomial tree of order k>0 comprises the root R, and k binomial subtrees, tex2html_wrap_inline65466, tex2html_wrap_inline65468, ..., tex2html_wrap_inline65470.

Figure gif shows the first five binomial trees, tex2html_wrap_inline65466- tex2html_wrap_inline65474. It follows directly from Definition gif that the root of tex2html_wrap_inline65448, the binomial tree of order k, has degree k. Since k may arbitrarily large, so too can the degree of the root. Furthermore, the root of a binomial tree has the largest fanout of any of the nodes in that tree.

   figure25767
Figure: Binomial trees tex2html_wrap_inline65466, tex2html_wrap_inline65468, ..., tex2html_wrap_inline65474.

The number of nodes in a binomial tree of order k is a function of k:

Theorem  The binomial tree of order k, tex2html_wrap_inline65448, contains tex2html_wrap_inline57764 nodes.

extbfProof (By induction). Let tex2html_wrap_inline65510 be the number of nodes in tex2html_wrap_inline65448, a binomial tree of order k.

Base Case By definition, tex2html_wrap_inline65466 consists a single node. Therefore tex2html_wrap_inline65518.

Inductive Hypothesis Assume that tex2html_wrap_inline65520 for tex2html_wrap_inline65522, for some tex2html_wrap_inline65524. Consider the binomial tree of order l+1:

displaymath65436

Therefore the number of nodes in tex2html_wrap_inline65528 is given by

eqnarray26047

Therefore, by induction on l, tex2html_wrap_inline65520 for all tex2html_wrap_inline60398.

It follows from Theorem gif that binomial trees only come in sizes that are a power of two. That is, tex2html_wrap_inline65536. Furthermore, for a given power of two, there is exactly one shape of binomial tree.

Theorem  The height of tex2html_wrap_inline65448, the binomial tree of order k, is k.

extbfProof (By induction). Let tex2html_wrap_inline65544 be the height of tex2html_wrap_inline65448, a binomial tree of order k.

Base Case By definition, tex2html_wrap_inline65466 consists a single node. Therefore tex2html_wrap_inline65552.

Inductive Hypothesis Assume that tex2html_wrap_inline65554 for tex2html_wrap_inline65522, for some tex2html_wrap_inline65524. Consider the binomial tree of order l+1:

displaymath65436

Therefore the height tex2html_wrap_inline65528 is given by

eqnarray26069

Therefore, by induction on l, tex2html_wrap_inline65554 for all tex2html_wrap_inline60398.

Theorem gif tells us that the height of a binomial tree of order k is k and Theorem gif tells us that the number of nodes is tex2html_wrap_inline65520. Therefore, the height of tex2html_wrap_inline65448 is exactly tex2html_wrap_inline58840.

Figure gif shows that there are two ways to think about the construction of binomial trees. The first way follows directly from the Definition gif. That is, binomial tex2html_wrap_inline65448 consists of a root node to which the k binomial trees tex2html_wrap_inline65466, tex2html_wrap_inline65468, ..., tex2html_wrap_inline65470 are attached as shown in Figure gif (a).

   figure26080
Figure: Two views of binomial tree tex2html_wrap_inline65474.

Alternatively, we can think of tex2html_wrap_inline65448 as being comprised of two binomial trees of order k-1. For example, Figure gif (b) shows that tex2html_wrap_inline65474 is made up of two instances of tex2html_wrap_inline65610. In general, suppose we have two trees of order k-1, say tex2html_wrap_inline65614 and tex2html_wrap_inline65616, where tex2html_wrap_inline65618. Then we can construct a binomial tree of order k by combining the trees to get

displaymath65438

Why do we call tex2html_wrap_inline65448 a binomial tree? It is because the number of nodes at a given depth in the tree is determined by the binomial coefficient. And the binomial coefficient derives its name from the binomial theorem. And the binomial theorem tells us how to compute the tex2html_wrap_inline57406 power of a binomial . And a binomial is an expression which consists of two terms, such as x+y. That is why it is called a binomial tree!

Theorem (Binomial Theorem)  The tex2html_wrap_inline57406 power of the binomial x+y for tex2html_wrap_inline57996 is given by

displaymath65439

where tex2html_wrap_inline65634 is called the binomial coefficient  .

extbfProof The proof of the binomial theorem is left as an exercise for the reader (Exercise gif).gif

The following theorem gives the expression for the number of nodes at a given depth in a binomial tree:

Theorem  The number of nodes at level l in tex2html_wrap_inline65448, the binomial tree of order k, where tex2html_wrap_inline65642, is given by the binomial coefficient tex2html_wrap_inline65644.

extbfProof (By induction). Let tex2html_wrap_inline65646 be the number of nodes at level l in tex2html_wrap_inline65448, a binomial tree of order k.

Base Case Since tex2html_wrap_inline65466 contains a single node, there is only one level in the tree, l=0, and exactly one node at that level. Therefore, tex2html_wrap_inline65658.

Inductive Hypothesis Assume that tex2html_wrap_inline65660 for tex2html_wrap_inline65662, for some tex2html_wrap_inline62578. The binomial tree of order h+1 is composed of two binomial trees of height h, one attached under the root of the other. Hence, the number of nodes at level l in tex2html_wrap_inline65672 is equal to the number of nodes at level l in tex2html_wrap_inline65676 plus the number of nodes at level l-1 in tex2html_wrap_inline65676:

eqnarray26310

Therefore by induction on h, tex2html_wrap_inline65660.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.