0% found this document useful (0 votes)
23 views2 pages

DSModule 4 Quiz 4

Uploaded by

vrt.kolluru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

DSModule 4 Quiz 4

Uploaded by

vrt.kolluru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

In a binary tree, the maximum number of nodes at level 'n' is:


A) 2^n
B) 2^(n+1) - 1
C) 2^(n-1)
D) 2^(n+1)

2. Which of the following is true about a binary search tree (BST)?


A) The left subtree of a node contains only nodes with keys greater than the node's key.
B) The right subtree of a node contains only nodes with keys less than the node's key.
C) The left and right subtrees must also be binary search trees.
D) The tree must be perfectly balanced.

3. What is the time complexity of searching for an element in a balanced binary search tree (BST)?
A) O(n)
B) O(log n)
C) O(1)
D) O(n log n)

4. In a pre-order traversal of a binary tree, the nodes are visited in which order?
A) Left subtree, right subtree, root
B) Root, left subtree, right subtree
C) Left subtree, root, right subtree
D) Right subtree, left subtree, root

5. Which of the following is NOT a self-balancing binary search tree?


A) AVL Tree
B) Red-Black Tree
C) Splay Tree
D) Binary Heap

6. In an AVL tree, the height difference between the left and right subtrees of any node should not
exceed:
A) 0
B) 1
C) 2
D) 3

7. What is a key characteristic of a Red-Black Tree?


A) All nodes are either red or black.
B) The root of the tree is always red.
C) The tree cannot have consecutive red nodes.
D) All leaf nodes are red.

8. Which tree operation is primarily used in a Splay Tree to bring a frequently accessed node to the
root?
A) Rotation
B) Splaying
C) Balancing
D) Deletion

9. Which of the following traversal methods is also known as Depth-First Search (DFS)?
A) Pre-order traversal
B) In-order traversal
C) Post-order traversal
D) Level-order traversal

10. In a binary search tree (BST), what is the worst-case time complexity for inserting an element if
the tree is skewed?
A) O(log n)
B) O(n)
C) O(1)
D) O(n log n)

You might also like