Questão 1
Questão
Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited in a postorder, inorder and preorder traversal, respectively, of a complete binary tree. Which of the following is always true?
Responda
-
LASTIN = LASTPOST
-
LASTIN = LASTPRE
-
LASTPRE = LASTPOST
-
None of the above
Questão 2
Questão
Which one of the following binary trees has its inorder and preorder traversals as BCAD and ABCD, respectively?
Questão 3
Questão
The numbers 1, 2, .... n are inserted in a binary search tree in some order. In the resulting tree, the right subtree of the root contains p nodes. The first number to be inserted in the tree must be
Questão 4
Questão
A binary search tree contains the numbers 1, 2, 3, 4, 5, 6, 7, 8. When the tree is traversed in pre-order and the values in each node printed out, the sequence of values obtained is 5, 3, 1, 2, 4, 6, 8, 7. If the tree is traversed in post-order, the sequence obtained would be
Responda
-
8, 7, 6, 5, 4, 3, 2, 1
-
1, 2, 3, 4, 8, 7, 6, 5
-
2, 1, 4, 3, 6, 7, 8, 5
-
2, 1, 4, 3, 7, 8, 6, 5
Questão 5
Questão
If all the edge weights of an undirected graph are positive, then any subset of edges that connects all the vertices and has minimum total weight is a
Responda
-
Hamiltonian cycle
-
grid
-
hypercube
-
tree
Questão 6
Questão
When searching for the key value 60 in a binary search tree, nodes containing the key values 10, 20, 40, 50, 70 80, 90 are traversed, not necessarily in the order given. How many different orders are possible in which these key values can occur on the search path from the root to the node containing the value 60?
Questão 7
Questão
The following three are known to be the preorder, inorder and postorder sequences of a binary tree. But it is not known which is which.
MBCAFHPYK
KAMCBYPFH
MABCKYFPH
Pick the true statement from the following.
Responda
-
I and II are preorder and inorder sequences, respectively
-
I and III are preorder and postorder sequences, respectively
-
II is the inorder sequence, but nothing more can be said about the other two sequences
-
II and III are the preorder and inorder sequences, respectively
Questão 8
Questão
Consider the following sequence of nodes for the undirected graph given below.
a b e f d g c
a b e f c g d
a d g e b c f
a d b c g e f
A Depth First Search (DFS) is started at node a. The nodes are listed in the order they are first visited. Which all of the above is (are) possible output(s)?
Responda
-
1 and 3 only
-
2 and 3 only
-
2, 3 and 4 only
-
1, 2, and 3
Questão 9
Questão
Which of the following statement is false?
Responda
-
A tree with n nodes has (n-1) edges.
-
A labeled rooted binary tree can be uniquely constructed given its postorder and preorder traversal results.
-
A complete binary tree with n internal nodes has (n+1) leaves.
-
The maximum number of nodes in a binary tree of height h is (2^(k+1) -1)
Questão 10
Questão
A complete n-ary tree is one in which every node has 0 or n sons. If x is the number of internal nodes of a complete n-ary tree, the number of leaves in it is given by
Responda
-
x(n-1)+1
-
xn-1
-
xn+1
-
x(n+1)
Questão 11
Questão
Which of the following sequences denotes the post order traversal sequence of the given tree?
a
/ \
b e
/ \ /
c d f
/
g
Responda
-
f e g c d b a
-
g c b d a f e
-
g c d b f e a
-
f e d g c b a