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
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
Which operation is used to combine two auxiliary trees?
A. Join
B. Combinatorial
C. Add
D. Concatenation
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
Which of the following is also known as Rope data structure?
A. Cord
B. String
C. Array
D. Linked List
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
Is Treap a randomized tree.
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
Which of the dynamic operations are used in Top Tree data structure implementation?
A. Link
B. Cut
C. Expose
D. All of the mentioned
Select an option to see the answer and solution.
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(n2 )
D. O(log n)
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
How many different shapes does maintenance of AA-Tree need to consider?
Select an option to see the answer and solution.
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
}Options are not available for this question.
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
For a binary tree the first node visited in in-order and post-order traversal is same.
Select an option to see the answer and solution.
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
Select an option to see the answer and solution.
Is the below tree representation of 50, 100,400,300,280 correct way to represent cartesian tree?
Select an option to see the answer and solution.
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)
Select an option to see the answer and solution.
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.dataA. 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
Select an option to see the answer and solution.