SKEDSOFT

Graph Theory

Hence max lmax =

For example,

The minimum possible height of n-vertex binary tree is min lmax = [log2(n 1) – 1] In analysis of algorithm, we are generally interested in computing the sum of the levels of all end vertices. This quantity, known as the path length (or external path length) of a tree.

 

 

 

Path length of a binary tree: It can be defined as the sum of the path lengths from the root to all end vertices.
For example,

Here the sum is 2 2 3 3 3 3 = 16 is the path length of a given above binary tree. The path length of the binary tree is often directly related to the executive time of an algorithm.

 

 

 

 

Binary tree representation of general trees: There is a straight forward technique for converting a general tree to a binary tree form. The algorithm has two easy steps :
Step 1 : Insert edges connecting siblings and delete all of a parents edges to its children except to its left most off spring.

Step 2 : Rotate the resulting diagram 45° to distinguish between left and right subtrees.
For example,


Here v2, v3 and v4 are siblings to the parent v1, now apply the steps given above we have a binary tree as shown here.