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 rootA. insert a new node
B. delete a node
C. search a node
D. count the number of nodes
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
A. key, left and right pointers, size
B. key, value
C. key, size
D. key
Select an option to see the answer and solution.
Which of the following is not the self balancing binary search tree?
A. AVL Tree
B. 2-3-4 Tree
C. Red - Black Tree
D. Splay Tree
Select an option to see the answer and solution.
When to choose Red-Black tree, AVL tree and B-trees?
A. many inserts, many searches and when managing more items respectively
B. many searches, when managing more items respectively and many inserts respectively
C. sorting, sorting and retrieval respectively
D. retrieval, sorting and retrieval respectively
Select an option to see the answer and solution.
Which type of binary search tree or algorithm does tango tree use?
A. Online
B. Offline
C. Static
D. Dynamic
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?
A. Each node has exactly zero or two children
B. A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from right to left
C. A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from left to right
D. A tree In which all nodes have degree 2
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.
A. O(log n)
B. O(nlog 2)
C. O(n)
D. O(1)
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());
}A. Preorder traversal
B. Inorder traversal
C. Postorder traversal
D. Level order traversal
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?
A. insertion, deletion, finding predecessor, successor
B. only insertion
C. only finding predecessor, successor
D. for sorting
Select an option to see the answer and solution.
In general, the node content in a threaded binary tree is . . . . . . . .
A. leftchild_pointer, left_tag, data, right_tag, rightchild_pointer
B. leftchild_pointer, left_tag
C. leftchild_pointer, left_tag, right_tag, rightchild_pointer
D. leftchild_pointer, left_tag, data
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?
A. O(n), O(n)
B. O(logn), O(logn)
C. O(logn), O(n)
D. O(n), O(logn)
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
A. constructs a cartesian tree
B. sorts the input sequence
C. does nothing
D. produces some random output
Select an option to see the answer and solution.
What is the traversal strategy used in the binary tree?
A. depth-first traversal
B. breadth-first traversal
C. random traversal
D. Priority traversal
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.