Question 1 (1 point) The worst case time complexity of counting the number of ch
ID: 3734613 • Letter: Q
Question
Question 1 (1 point)
The worst case time complexity of counting the number of children of an internal node on a tree (general tree) is O(n).
Question 1 options:
A) True
B) False
Question 2 (1 point)
The worst case time complexity of removing an external(leaf) node referenced by variable p on a binary tree is O(n).
Question 2 options:
True
False
Question 3 (1 point)
Assume p refers to a node on a binary tree. The node structure is defined as a element field and three reference variables as shown on the slides. The worst time complexity of updating the element field of p's parent is O(n).
Question 3 options:
True
False
Question 4 (1 point)
The time complexity to determine whether a node is an internal or external node on a reference-based implementation binary tree is O(1).
Question 4 options:
True
False
Question 5 (1 point)
The worst time complexity to obtain the sibling of a node on a general tree is O(n).
Question 5 options:
True
False
Question 6 (3 points)
Given the tree shown above, which of the following statement is not true?
Question 6 options:
I is an internal node
the depth of node G is the same as node K
Node H and J are sibling nodes
This tree is not a Binary tree
Question 7 (3 points)
The maximum height for a binary tree with n node is?
Question 7 options:
O(logn)
O(1)
O(n^2)
O(n)
Question 8 (3 points)
The time complexity for traversal on a binary tree is ______.
Question 8 options:
A)
O(1)
B)
O(n)
C)
O(nlogn)
D)
O(n^2)
A) True
B) False
G H M (N)OExplanation / Answer
Answer:
Question 1:
The Answer is TRUE
Question 2:
The Answer is TRUE
Question 3:
The Answer is TRUE
Question 4:
The Answer is FALSE
Question 5:
The Answer is TRUE
Question 6:
The Answer is This tree is not a binary tree (Option D)
Because, The nodes A, B, E, and I have more than two children. (A binary tree should have atmost two children)
Question 7:
The Maximum height of a binary tree with n nodes is O(n) (Option D)
Question 8:
The traversal of a binary tree requires that all tree nodes are processed, the minimum complexity of any traversal algorithm is O(n), i.e. linear with respect to the number of nodes in the tree.
The Answer is O(n) (Option B)