Data Structures :: Trees

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

NA
SHSTTON
108
Solv. Corr.
82
Solv. In. Corr.
190
Attempted
0 M:33 S
Avg. Time

1 / 194

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

| | | Asked In Commvault |

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
79
Solv. Corr.
102
Solv. In. Corr.
181
Attempted
0 M:0 S
Avg. Time

2 / 194

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);

| | | Asked In CommvaultCapgeminiSociete Generale |

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
76
Solv. Corr.
140
Solv. In. Corr.
216
Attempted
0 M:8 S
Avg. Time

3 / 194

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

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
56
Solv. Corr.
148
Solv. In. Corr.
204
Attempted
0 M:48 S
Avg. Time

4 / 194

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

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
37
Solv. Corr.
148
Solv. In. Corr.
185
Attempted
0 M:0 S
Avg. Time

5 / 194

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

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
60
Solv. Corr.
105
Solv. In. Corr.
165
Attempted
0 M:0 S
Avg. Time

6 / 194

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.

Dcomplete binary tree.

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
73
Solv. Corr.
95
Solv. In. Corr.
168
Attempted
0 M:0 S
Avg. Time

7 / 194

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.

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
48
Solv. Corr.
118
Solv. In. Corr.
166
Attempted
0 M:0 S
Avg. Time

8 / 194

Choose the correct option.

The number of different directed trees with 3 nodes are

A2

B4

C3

D5

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
32
Solv. Corr.
126
Solv. In. Corr.
158
Attempted
1 M:39 S
Avg. Time

9 / 194

Choose the correct option.

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

Ainorder

Bpreorder

Cpostorder

Dany orde

| | | Asked In Societe Generale |

Explanation:

Here is no explanation for this answer

Workspace

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

10 / 194

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

Explanation:

Here is no explanation for this answer

Workspace