Data Structures :: Trees

Home > Technical Aptitude > Data Structures > Trees > General Questions

NA
SHSTTON
60
Solv. Corr.
46
Solv. In. Corr.
106
Attempted
0 M:33 S
Avg. Time

1 / 33

Choose the correct option.

What are the number of nodes of left and right sub-tree of the binary tree if the data is inserted in the following order:\r\n 45, 15, 8, 5 6, 5, 65, 47, 12, 18, 10, 73, 50, 16, 61


A7 6

B6 7

C8 5

D5 8

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
46
Solv. Corr.
46
Solv. In. Corr.
92
Attempted
0 M:0 S
Avg. Time

2 / 33

Choose the correct option.
Consider the following code segment in C to traverse a binary tree using the preorder

typedef struct tree {
int info;
struct  *left;
struct  *right;
}node;

void preorder(node *tree)
{
if (t)
{
Statementl
Statement2
Statement3
}
}
The above Statements should be

Apreorder(tree->right); preorder(tree->left); printf("%d", tree->info);

Bpreorder(tree->left); preorder(tree->right); printf("%d", tree->info);

Cpreorder(tree->left); printf("%d", tree->info); preorder(tree->right);

Dprintf("%d", tree->info); preorder(tree->left); preorder(tree->right);

 View Answer |  Discuss in Forum |  Workspace | Asked In CommvaultCapgemini |

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
40
Solv. Corr.
60
Solv. In. Corr.
100
Attempted
0 M:8 S
Avg. Time

3 / 33

Choose the correct option.

The worst case time complexity of AVL tree is better in comparison to binary search tree for


ASearch and Insert Operations

BSearch and Delete Operations

CInsert and Delete Operations

DSearch, Insert and Delete Operations

Answer: Option D

Explanation:

Search is O(log N) since AVL trees are always balanced. Insertion and deletions are also O(logn) where as in case of BST it is O(n).

Workspace

NA
SHSTTON
30
Solv. Corr.
78
Solv. In. Corr.
108
Attempted
1 M:17 S
Avg. Time

4 / 33

Choose the correct option.

A full binary tree with 2n+1 nodes contain


An leaf nodes

Bn non-leaf nodes

C(n-1) leaf nodes

D(n-1) non-leaf nodes

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
20
Solv. Corr.
80
Solv. In. Corr.
100
Attempted
0 M:0 S
Avg. Time

5 / 33

Choose the correct option.

If a node in a BST has two children, then its inorder predecessor has


Ano left child

Bno right child

Ctwo children

Dno child

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
27
Solv. Corr.
55
Solv. In. Corr.
82
Attempted
0 M:0 S
Avg. Time

6 / 33

Choose the correct option.

A binary tree in which if all its levels except possibly the last, have the maximum number of nodes and all the nodes at the last level appear as far left as possible, is known as


Afull binary tree.

BAVL tree.

Cthreaded tree.

Dcomplete binary tree.

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
34
Solv. Corr.
55
Solv. In. Corr.
89
Attempted
0 M:0 S
Avg. Time

7 / 33

Choose the correct option.

A full binary tree with n leaves contains


An nodes.

B(log2 n)nodes.

C(2n-1) nodes.

D2^n nodes.

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
25
Solv. Corr.
65
Solv. In. Corr.
90
Attempted
0 M:0 S
Avg. Time

8 / 33

Choose the correct option.

The number of different directed trees with 3 nodes are


A2

B4

C3

D5

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
18
Solv. Corr.
68
Solv. In. Corr.
86
Attempted
0 M:0 S
Avg. Time

9 / 33

Choose the correct option.

One can convert a binary tree into its mirror image by traversing it in


Ainorder

Bpreorder

Cpostorder

Dany orde

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
39
Solv. Corr.
46
Solv. In. Corr.
85
Attempted
0 M:0 S
Avg. Time

10 / 33

Choose the correct option.

The number of leaf nodes in a complete binary tree of depth d is


A2^d

B[2^(d-1)]+1

C[2^(d+1)]+1

D(2^d)+1

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace