The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
0 votes

Can you please find time complexity of the recurrence using Variable Substitue method and Master Theroem:

What is the time complexity of the following recursive function 
int recursion (int n) 

if(n ≤ 1) 
return 1; 
return(recursion(sqrt(n)) + 1); 


// i solved it using substitution method.

asked in Algorithms by Veteran (16.9k points)
edited by | 137 views

1 Answer

+2 votes
Best answer

T(n) = T(root(n))+1
let n= 2k
let T(2K) = G(k)
G(k) = G(k/2)+1
using extended master's theorem
a=1 b=2 k=0,p=0
a=bk it will be G(k) = O(logk) = T(2k)
we know K=logn substitute in O(logk) = O(loglogn)

Credits: Sanju

answered by Veteran (16.9k points)
edited by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

29,138 questions
36,959 answers
34,803 users