Time-Complexity
February 13, 2024Question 9704 – Time-Complexity
February 13, 2024Question 9848 – Time-Complexity
Consider the following functions
Which of the following is true?
Correct Answer: D
Question 13 Explanation:
Consider n value as 210
Then
f(n) = 3(n32) = 3*(210)32 = 3*2320
g(n) = 2320
h(n) = 1024!
So relation between the functions can be:
f(n) and g(n) are of same order, so f(n) is O(g(n)) and g(n) = O(f(n)). Option C is wrong.
h(n) is n! Which is of higher order than f(n) and g(n). So options A and B are wrong.
Then
f(n) = 3(n32) = 3*(210)32 = 3*2320
g(n) = 2320
h(n) = 1024!
So relation between the functions can be:
f(n) and g(n) are of same order, so f(n) is O(g(n)) and g(n) = O(f(n)). Option C is wrong.
h(n) is n! Which is of higher order than f(n) and g(n). So options A and B are wrong.
h(n) is O (f(n))
h(n) is O (g(n))
g(n) is not O (f(n))
f(n) is O(g(n))
Subscribe
Login
0 Comments