In this Blog we are providing all the UGC-NET Computer Science previous year Questions with explanation:
Q : 6 A full binary tree with n leaves contains
(A) n nodes
(B) log2n nodes
(C) 2n –1 nodes
(D) 2n nodes
Answer : (C)
Explanation :
A full binary tree is one in which each node has exactly two children. Like on given below is a full binary tree with 15 nodes:
No. of internal nodes are given by 'No. of External or Leaf nodes - 1'.
In our question we have to find total no. of nodes in the tree. We are given that total no. of leaf nodes are 'n'. Total no. of nodes in tree = Total No. of Leaf Nodes + Total No. of Internal Nodes
=> Total no. of nodes in tree = n + n - 1 = 2n-1.
We can examine this by putting the no. leaf nodes of the above tree in given formula which is 8.
Total no. nodes in tree = 2 * 8 - 1 = 16 - 1 = 15.
Hence correct option is (C).
Q : 6 A full binary tree with n leaves contains
(A) n nodes
(B) log2n nodes
(C) 2n –1 nodes
(D) 2n nodes
Answer : (C)
Explanation :
A full binary tree is one in which each node has exactly two children. Like on given below is a full binary tree with 15 nodes:
No. of internal nodes are given by 'No. of External or Leaf nodes - 1'.
In our question we have to find total no. of nodes in the tree. We are given that total no. of leaf nodes are 'n'. Total no. of nodes in tree = Total No. of Leaf Nodes + Total No. of Internal Nodes
=> Total no. of nodes in tree = n + n - 1 = 2n-1.
We can examine this by putting the no. leaf nodes of the above tree in given formula which is 8.
Total no. nodes in tree = 2 * 8 - 1 = 16 - 1 = 15.
Hence correct option is (C).
This question was taken from (UGC-NET Computer Science December 2014 Paper 2).
No comments:
Post a Comment