Q. In a complete binary tree, what is the relationship between the number of nodes and the height?
A.
Height = log(n)
B.
Height = n
C.
Height = n/2
D.
Height = n^2
Show solution
Solution
In a complete binary tree, the height is approximately log(n), where n is the number of nodes.
Correct Answer:
A
— Height = log(n)
Learn More →
Q. What is the primary application of a binary tree?
A.
Sorting data
B.
Storing hierarchical data
C.
Searching data
D.
All of the above
Show solution
Solution
Binary trees can be used for sorting, searching, and storing hierarchical data, making them versatile data structures.
Correct Answer:
D
— All of the above
Learn More →
Q. What traversal method would you use to delete a binary tree?
A.
Pre-order
B.
In-order
C.
Post-order
D.
Level-order
Show solution
Solution
Post-order traversal is used to delete a binary tree because it ensures that a node is deleted only after its children have been deleted.
Correct Answer:
C
— Post-order
Learn More →
Q. Which of the following is NOT a valid application of binary trees?
A.
Expression parsing
B.
Priority queues
C.
Database indexing
D.
Sorting algorithms
Show solution
Solution
Binary trees are not typically used for sorting algorithms; instead, they are used for expression parsing, priority queues, and database indexing.
Correct Answer:
D
— Sorting algorithms
Learn More →
Q. Which traversal method is used to get the nodes of a binary tree in non-decreasing order?
A.
Pre-order
B.
Post-order
C.
In-order
D.
Level-order
Show solution
Solution
In-order traversal visits the left subtree, the root, and then the right subtree, which results in nodes being accessed in non-decreasing order for binary search trees.
Correct Answer:
C
— In-order
Learn More →
Showing 1 to 5 of 5 (1 Pages)