1.

Define the following: (i) Tree ( recursive defination) (ii) Level of a node. (iii) Height of a tree. (iv) Complete Binary tree. (v) Internal Path length.

Answer»

(i) Tree (recursive definition) 

A tree is a finite set of one or more nodes such that. 

(1) There is a specially designated node called the root. 

(2) The remaining nodes are partitioned into n>=0 disjoint sets 

T1, T2 ... Tn where each of these sets is a tree. T1, T2 ... Tn are called the subtree of the root.

(ii) Level of a node

The root is at level 0(zero) and the level of any node is 1 more than the level of its parent. 

(iii) Height of a tree

The length of the longest path from root to any node is known as the height of the tree. 

(iv) Complete Binary tree

A complete binary tree can be defined as a binary tree whose non leaf nodes have nonempty left and right sub tree and all leaves are at the same level. 

(v) Internal Path length

It is defined as the number of node traversed while moving through one particular node to any other node in the tree. 



Discussion

No Comment Found

Related InterviewSolutions