...
Question 9571 – Time-Complexity
February 13, 2024
Question 10668 – Time-Complexity
February 13, 2024
Question 9571 – Time-Complexity
February 13, 2024
Question 10668 – Time-Complexity
February 13, 2024

Question 9573 – Time-Complexity

A program takes as input a balanced binary search tree with n leaf nodes and computes the value of a function g(x) for each node x. If the cost of computing g(x) is min{no. of leaf-nodes in left-subtree of x, no. of leaf-nodes in right-subtree of x} then the worst-case time complexity of the program is

Correct Answer: B

Question 23 Explanation: 
Contains a balanced binary search tree.
⇒ g(x) = min (no. of leaf nodes of left-subtree of x, no. of leaf nodes in the right-subtree of x)
→ Total no. of leaves = n
Time complexity for a binary search = log n
Time complexity of the program is = O(n(log n))
A
Θ (n)
B
Θ (n log n)
C
Θ (n2)
D
Θ (n2 log n)
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!