Vidyalelo
Data Structure · all questions

Binary Search Trees(B Tree)
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

275

Questions

10/14

Page

Pick an option on a question to see the right answer and solution.

What is the below pseudo code trying to do, where pt is a node pointer and root pointer?
redblack(Node root, Node pt) :
  if (root == NULL)
     return pt
 
  if (pt.data < root.data)
  {
      root.left  =   redblack(root.left, pt);
      root.left.parent = root
  }
  else if (pt.data > root.data)
  {
      root.right = redblackt(root.right, pt)
      root.right.parent = root
  }
 return root

Select an option to see the answer and solution.

Select the code snippet which performs pre-order traversal.

Options are not available for this question.

Select an option to see the answer and solution.

A node of the weight balanced tree has

Select an option to see the answer and solution.

Which of the following is not the self balancing binary search tree?

Select an option to see the answer and solution.

When to choose Red-Black tree, AVL tree and B-trees?

Select an option to see the answer and solution.

Which type of binary search tree or algorithm does tango tree use?

Select an option to see the answer and solution.

For how many vertices in a set, is top tree defined for underlying tree?

Select an option to see the answer and solution.

What is a complete binary tree?

Select an option to see the answer and solution.

How many randomized binary search trees can be formed by the numbers (1, 3, 2)?

Select an option to see the answer and solution.

Balanced binary tree with n items allows the lookup of an item in . . . . . . . . worst-case time.

Select an option to see the answer and solution.

What does the following piece of code do?
public void func(Tree root)
{
	System.out.println(root.data());
	func(root.left());
	func(root.right());
}

Select an option to see the answer and solution.

What are the operations that could be performed in O(logn) time complexity by red-black tree?

Select an option to see the answer and solution.

In general, the node content in a threaded binary tree is . . . . . . . .

Select an option to see the answer and solution.

To restore the AVL property after inserting a element, we start at the insertion point and move towards root of that tree. is this statement true?

Select an option to see the answer and solution.

Given that 2 elements are present in the tree, write a function to find the LCA(Least Common Ancestor) of the 2 elements.

Options are not available for this question.

Select an option to see the answer and solution.

What will be the height of a balanced full binary tree with 8 leaves?

Select an option to see the answer and solution.

What are the worst case and average case complexities of a binary search tree?

Select an option to see the answer and solution.

What happens if we apply the below operations on an input sequence?
i. construct a cartesian tree for input sequence
ii. put the root element of above tree in a priority queue
iii. if( priority queue is not empty) then
iv. search and delete minimum value in priority queue
v. add that to output
vi. add cartesian tree children of above node to priority queue

Select an option to see the answer and solution.

What is the traversal strategy used in the binary tree?

Select an option to see the answer and solution.

In postorder traversal of binary tree right subtree is traversed before visiting root.

Select an option to see the answer and solution.