Data Structure Questions and Answers-Binary Trees using Array

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<

Data Structure Questions and Answers-Binary Trees using Array

Question 1
Binary trees can have how many children?
A
2
B
any number of children
C
0 or 1 or 2
D
0 or 1
Data interpretation (DI) Questions answers
Question 1 Explanation: 
Can have atmost 2 nodes.

Question 2
Disadvantage of using array representation for binary trees is?
A
difficulty in knowing children nodes of a node
B
difficult in finding the parent of a node
C
have to know the maximum number of nodes possible before creation of trees
D
difficult to implement
Reasoning Questions answers
Question 2 Explanation: 
The array is fixed size (may be dynamic array or static array) but size is fixed.

Question 3
What must be the ideal size of array if the height of tree is 'l'?
A
2l-1
B
l-1
C
l
D
2l
Library science Questions answers
Question 3 Explanation: 
Since maximum elements in a tree (complete binary tree) of height l will be 2l-1 so a good array size must be that (since a binary tree node may not always have 2 children but for safety a is correct).

Question 4
What are the children for node 'w' of a complete-binary tree in an array representation?
A
2w and 2w+1
B
2+w and 2-w
C
w+1/2 and w/2
D
w-1/2 and w+1/2
Aptitude test Questions answers
Question 4 Explanation: 
Since each node has 2 children and so counting from beginning, a particular node will have children as option a.

Question 5
What is the parent for a node 'w' of a complete binary tree in an array representation when w is not 0?
A
floor(w-1/2)
B
ceil(w-1/2)
C
w-1/2
D
w/2
Geography Questions answers
Question 5 Explanation: 
Floor of w-1/2 because we can't miss a node.

There are 5 questions to complete.

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<