Data Structure and Algorithm Analysis
Questions 71 to 80
| 
71. | 
The
  Following is a binary tree. Answer questions (11 – 13) considering the below
  given tree. 
The
  In-order traversal of the above tree is 
 | ||||||||||
| 
72. | 
The
  Pre-order traversal for the tree in question -11 is 
 | ||||||||||
| 
73. | 
The
  Post-order traversal for the tree in question -11 is 
 | ||||||||||
| 
74. | 
There are
  four trees named A, B, C and D having 8, 15, 13, 14 nodes in them
  respectively. Which of them could have formed a full binary tree? 
 | ||||||||||
| 
75. | 
In the
  given binary tree if the nodes are stored in an array, then where the node 4
  can be stored? 
 | ||||||||||
| 
76. | 
Of the
  following tree structure, which is efficient, considering space and time
  complexities? 
 | ||||||||||
| 
77. | 
Consider
  the following two statements and choose the correct option: 
I.     According to Access strategies Linked
  List is a linear one. 
II.     According to Storage Linked List is a
  Non-linear one. 
 | ||||||||||
| 
78. | 
Which of
  the following are differences between structures and arrays? 
 | ||||||||||
| 
79. | 
Which of
  the following pairs of statements are identical? 
 | ||||||||||
| 
80. | 
A
  "stack" is also known as what? 
 | 
Answers
| 
71. | 
Answer :  (b) 
Reason : Because the rules for traversing the binary
  tree in In-order are: 
              i.            Traverse the left sub tree in In-order 
              ii.     Traverse the root 
              iii.    Traverse the right sub tree in In-order | ||||||||||||||||||
| 
72. | 
Answer :  (d) 
Reason : Because the rules for traversing the binary
  tree in Pre-order are: 
              i.            Traverse the root  
              ii.     Traverse the left sub tree in Pre-order 
              iii.    Traverse
  the right sub tree in Pre-order | ||||||||||||||||||
| 
73. | 
Answer :  (c) 
Reason : Because the rules for traversing the binary
  tree in Post-order are: 
              i.            Traverse the left sub tree in Post-order 
              ii.     Traverse the right sub tree in Post-order 
              iii.    Traverse the root | ||||||||||||||||||
| 
74. | 
Answer :  (b) 
Reason : In general there are 2n-1 nodes in a full binary tree. 
              By the method of elimination: Full
  binary trees contain odd number of nodes. So there cannot be full binary
  trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete
  binary tree but not a full binary tree. So the correct answer is 15. | ||||||||||||||||||
| 
75. | 
Answer :  (a) 
Reason : At location 
  6 
 
              where
  LCn means Left Child of node ‘n’ and RCn means Right Child  of node ‘n’. Top row represents the node
  values and bottom row represents the positions. | ||||||||||||||||||
| 
76. | 
Answer :  (b) 
Reason : Complete Binary Tree.  
              By the method of elimination: Full binary tree loses its nature
  when operations of insertions and deletions are done. For incomplete binary
  trees, extra storage is required and overhead of NULL node checking takes
  place. So complete binary tree is the better one since the property of
  complete binary tree is maintained even after operations like additions and
  deletions are done on it | ||||||||||||||||||
| 
77. | 
Answer :  (c) 
Reason : As the linked list nodes do not have any index and hence they must
  be accessed in linear order always. Also they are stored in discrete
  locations and not in contiguous memory locations. | ||||||||||||||||||
| 
78. | 
Answer :  (d) 
Reason : As this is the most suitable option when compared to the other
  options. Also option c, e are wrong. | ||||||||||||||||||
| 
79. | 
Answer :  (e) 
Reason : As both the operators [à and (*). ] are used to access the members of the structure through
  pointers. All the other options have the syntax errors. | ||||||||||||||||||
| 
80. | 
Answer :  (c) 
Reason : As the Stack behaves in Last In First Out manner. | 
Answers:
| 
71. | 
Answer :  (b) 
Reason : Because the rules for traversing the binary
  tree in In-order are: 
              i.            Traverse the left sub tree in In-order 
              ii.     Traverse the root 
              iii.    Traverse the right sub tree in In-order | ||||||||||||||||||
| 
72. | 
Answer :  (d) 
Reason : Because the rules for traversing the binary
  tree in Pre-order are: 
              i.            Traverse the root  
              ii.     Traverse the left sub tree in Pre-order 
              iii.    Traverse
  the right sub tree in Pre-order | ||||||||||||||||||
| 
73. | 
Answer :  (c) 
Reason : Because the rules for traversing the binary
  tree in Post-order are: 
              i.            Traverse the left sub tree in Post-order 
              ii.     Traverse the right sub tree in Post-order 
              iii.    Traverse the root | ||||||||||||||||||
| 
74. | 
Answer :  (b) 
Reason : In general there are 2n-1 nodes in a full binary tree. 
              By the method of elimination: Full
  binary trees contain odd number of nodes. So there cannot be full binary
  trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete
  binary tree but not a full binary tree. So the correct answer is 15. | ||||||||||||||||||
| 
75. | 
Answer :  (a) 
Reason : At location 
  6 
 
              where
  LCn means Left Child of node ‘n’ and RCn means Right Child  of node ‘n’. Top row represents the node
  values and bottom row represents the positions. | ||||||||||||||||||
| 
76. | 
Answer :  (b) 
Reason : Complete Binary Tree.  
              By the method of elimination: Full binary tree loses its nature
  when operations of insertions and deletions are done. For incomplete binary
  trees, extra storage is required and overhead of NULL node checking takes
  place. So complete binary tree is the better one since the property of
  complete binary tree is maintained even after operations like additions and
  deletions are done on it | ||||||||||||||||||
| 
77. | 
Answer :  (c) 
Reason : As the linked list nodes do not have any index and hence they must
  be accessed in linear order always. Also they are stored in discrete
  locations and not in contiguous memory locations. | ||||||||||||||||||
| 
78. | 
Answer :  (d) 
Reason : As this is the most suitable option when compared to the other
  options. Also option c, e are wrong. | ||||||||||||||||||
| 
79. | 
Answer :  (e) 
Reason : As both the operators [à and (*). ] are used to access the members of the structure through
  pointers. All the other options have the syntax errors. | ||||||||||||||||||
| 
80. | 
Answer :  (c) 
Reason : As the Stack behaves in Last In First Out manner. | 
 


 
No comments :
Post a Comment