Identify and justify the asymptotic run time of this algorithm in terms of n. soRecursive(n) 1 if n < 3 2 return 1 3 els
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Identify and justify the asymptotic run time of this algorithm in terms of n. soRecursive(n) 1 if n < 3 2 return 1 3 els
Identify and justify the asymptotic run time of this algorithm in terms of n. soRecursive(n) 1 if n < 3 2 return 1 3 else 4 return n soRecursive(n/3) A. O(log3n) = O(lg n) since it takes O(log3n) calls to reach the base case and base of log is a constant difference B. O(n/3) = O(n) since the input is divided by 3 and we factor out constants in o O C. n * log3(n) = O(n Ig n) since n is multiplied by the recursive call, it takes O(log3n) calls to reach the base case, and base of log is a constant difference D. n * (n/3) = O(na) since n is multiplied by the recursive call and we factor out constants in o
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!