CommerceBinary Search TreesB Tree MCQs
Practice Binary Search TreesB Tree MCQs for competitive exams.
Binary Search TreesB Tree MCQs
Practice questions from this topic.
If A ꓵ B (A and B are two clusters) is a singleton set then it is a Merge able cluster.
- A. True
- B. False
Correct Answer: A
AA-Trees makes more rotations than a red-black tree.
- A. True
- B. False
Correct Answer: A
Disadvantages of linked list representation of binary trees over arrays?
- A. Randomly accessing is not possible
- B. Extra memory for a pointer is needed with every element in the list
- C. Difficulty in deletion
- D. Random access is not possible and extra memory with every element
Correct Answer: D
What is wrong with below code for inorder traversal of inorder threaded binary tree: inordertraversal(threadedtreenode root): threadedtreenode q = inorderpredecessor(root) while(q!=root): q=inorderpredecessor(q) print q.data
- A. inordersuccessor instead of inorderpredecessor must be done
- B. code is correct
- C. it is code for post order
- D. it is code for pre order
Correct Answer: A
What is the space complexity of the post-order traversal in the recursive fashion? (d is the tree depth and n is the number of nodes)
- A. O(1)
- B. O(nlogd)
- C. O(logd)
- D. O(d)
Correct Answer: D
Is the below tree representation of 50, 100,400,300,280 correct way to represent cartesian tree?
- A. true
- B. false
Correct Answer: A
Advantages of linked list representation of binary trees over arrays?
- A. dynamic size
- B. ease of insertion/deletion
- C. ease in randomly accessing a node
- D. both dynamic size and ease in insertion/deletion
Correct Answer: D
For a binary tree the first node visited in in-order and post-order traversal is same.
- A. True
- B. False
Correct Answer: B
A full binary tree can be generated using . . . . . . . .
- A. post-order and pre-order traversal
- B. pre-order traversal
- C. post-order traversal
- D. in-order traversal
Correct Answer: A
What must be the missing logic in place of missing lines for finding sum of nodes of binary tree in alternate levels? //e.g:-consider -complete binary tree:-height-3, [1,2,3,4,5,6,7]-answer must be 23 n=power(2,height)-1; //assume input is height and a[i] contains tree elements for(i=1;i<=n;) { //present level is initialized to 1 and sum is initialized to 0 for(j=1;j<=pow(2,currentlevel-1);j++) { sum=sum+a[i]; i=i+1; } //missing logic }
- A. i=i+pow(2,currentlevel); currentlevel=currentlevel+2; j=1
- B. i=i+pow(2,currentlevel); currentlevel=currentlevel+2; j=0
- C. i=i-pow(2,currentlevel); currentlevel=currentlevel+2; j=1
- D. i=i+pow(2,currentlevel); currentlevel=currentlevel+1; j=1
Correct Answer: A
How many different shapes does maintenance of AA-Tree need to consider?
- A. 7
- B. 5
- C. 2
- D. 3
Correct Answer: C
A treap is a cartesian tree with . . . . . . . .
- A. additional value, which is a priority value to the key generated randomly
- B. additional value, which is a priority value to the key generated sequentially
- C. additional heap rule
- D. additional operations like remove a range of elements
Correct Answer: A