Binary Trees - 1
Definition: A
binary tree
is a rooted tree in which no vertex has more than two children
-
each vertex has 0, 1, or 2 children
Definition: A binary tree is
complete
iff the only vertices with less than
two children are in the bottom two layers
- Vertices in the bottom layer have 0 children
- Vertices in the penultimate layer have 0, 1, or 2 children
- All other vertices have 2 children
- Note that a binary tree is complete iff every layer but the bottom is fully
populated with vertices
A complete binary tree with n vertices and height H satisfies:
- 2H <= n < 2H+1
- H <= log n < H + 1
- H == floor(log n)
|