CommerceBinary Search TreesB Tree MCQs
Practice Binary Search TreesB Tree MCQs for competitive exams.
Binary Search TreesB Tree MCQs
Practice questions from this topic.
Which of the following is an advantage of balanced binary search tree, like AVL tree, compared to binary heap?
- A. insertion takes less time
- B. deletion takes less time
- C. searching takes less time
- D. construction of the tree takes less time than binary heap
Correct Answer: A
What is the time complexity for the update cost on auxiliary trees?
- A. O (log (log n))
- B. k-1 O (log n)
- C. K 2 O (log n)
- D. k+1 O (log (log n))
Correct Answer: D
Which of the following pair's traversals on a binary tree can build the tree uniquely?
- A. post-order and pre-order
- B. post-order and in-order
- C. post-order and level order
- D. level order and preorder
Correct Answer: B
Which of the below statements are true? i. Cartesian tree is not a height balanced tree ii. Cartesian tree of a sequence of unique numbers can be unique generated
- A. both statements are true
- B. only i. is true
- C. only ii. is true
- D. both are false
Correct Answer: A
What is missing in this logic of finding a path in the tree for a given sum (i.e checking whether there will be a path from roots to leaf nodes with given sum)? checkSum(struct bin-treenode *root , int sum) : if(root==null) return sum as 0 else : leftover_sum=sum-root_node-->value //missing
- A. code for having recursive calls to either only left tree or right trees or to both subtrees depending on their existence
- B. code for having recursive calls to either only left tree or right trees
- C. code for having recursive calls to either only left tree
- D. code for having recursive calls to either only right trees
Correct Answer: A
Two balanced binary trees are given with m and n elements respectively. They can be merged into a balanced binary search tree in . . . . . . . . time.
- A. O(m+n)
- B. O(mn)
- C. O(m)
- D. O(mlog n)
Correct Answer: A
What is inefficient with the below threaded binary tree picture?
- A. it has dangling pointers
- B. nothing inefficient
- C. incorrect threaded tree
- D. space is being used more
Correct Answer: A
Which type of data structure does rope represent?
- A. Array
- B. Linked List
- C. Queue
- D. Binary Tree
Correct Answer: D
Level order traversal of a tree is formed with the help of
- A. breadth first search
- B. depth first search
- C. dijkstra's algorithm
- D. prims algorithm
Correct Answer: A
Which of the following properties are obeyed by all three tree - traversals?
- A. Left subtrees are visited before right subtrees
- B. Right subtrees are visited before left subtrees
- C. Root node is visited before left subtree
- D. Root node is visited before right subtree
Correct Answer: A
How many orders of traversal are applicable to a binary tree (In General)?
- A. 1
- B. 4
- C. 2
- D. 3
Correct Answer: D
For the tree below, write the post-order traversal.
- A. 6, 2, 7, 2, 5, 11, 9, 5, 4
- B. 6, 5, 11, 2, 7, 5, 9, 4, 2
- C. 6, 5, 2, 11, 7, 4, 9, 5, 2
- D. 6, 2, 7, 2, 11, 5, 5, 9, 4
Correct Answer: C