CommerceBinary Search TreesB Tree MCQs
Practice Binary Search TreesB Tree MCQs for competitive exams.
Binary Search TreesB Tree MCQs
Practice questions from this topic.
The binary tree sort implemented using a self - balancing binary search tree takes . . . . . . . . time is worst case.
- A. O(n log n)
- B. O(n)
- C. O(n 2 )
- D. O(log n)
Correct Answer: A
Which of the dynamic operations are used in Top Tree data structure implementation?
- A. Link
- B. Cut
- C. Expose
- D. All of the mentioned
Correct Answer: D
What are double and single threaded trees?
- A. when both left, right nodes are having null pointers and only right node is null pointer respectively
- B. having 2 and 1 node
- C. using single and double linked lists
- D. using heaps and priority queues
Correct Answer: A
Is Treap a randomized tree.
- A. True
- B. False
Correct Answer: A
Why to prefer splay trees?
- A. easier to program
- B. space efficiency
- C. easier to program and faster access to recently accessed items
- D. quick searching
Correct Answer: C
Which of the following is also known as Rope data structure?
- A. Cord
- B. String
- C. Array
- D. Linked List
Correct Answer: A
Using what formula can a parent node be located in an array?
- A. (i+1)/2
- B. (i-1)/2
- C. i/2
- D. 2i/2
Correct Answer: B
Which operation is used to combine two auxiliary trees?
- A. Join
- B. Combinatorial
- C. Add
- D. Concatenation
Correct Answer: A
What is the code below trying to print? void print(tree *root,tree *node) { if(root ==null) return 0 if(root-->left==node || root-->right==node) || print(root->left,node) ||printf(root->right,node) { print(root->data) } }
- A. just printing all nodes
- B. not a valid logic to do any task
- C. printing ancestors of a node passed as argument
- D. printing nodes from leaf node to a node passed as argument
Correct Answer: C
The balance factor of a node in a binary tree is defined as . . . . . . . .
- A. addition of heights of left and right subtrees
- B. height of right subtree minus height of left subtree
- C. height of left subtree minus height of right subtree
- D. height of right subtree minus one
Correct Answer: C
Consider a sequence of numbers to have repetitions, how a cartesian tree can be constructed in such situations without violating any rules?
- A. use any tie-breaking rule between repeated elements
- B. cartesian tree is impossible when repetitions are present
- C. construct a max heap in such cases
- D. construct a min heap in such cases
Correct Answer: A
Several other operations like union set difference and intersection can be done in treaps.
- A. True
- B. False
Correct Answer: A