Duplicate: https://gateoverflow.in/226144/time-complexity

Check for duplicates before asking a question.

Read rules: https://csedoubts.gateoverflow.in/blog/1/guidelines-to-users

Awesome q2a theme

0 votes

closed with the note:
Duplicate: https://gateoverflow.in/226144/time-complexity

- 🚩 Duplicate | 👮 Shiva Sagar Rao

0

Duplicate: https://gateoverflow.in/226144/time-complexity

Check for duplicates before asking a question.

Read rules: https://csedoubts.gateoverflow.in/blog/1/guidelines-to-users

0 votes

Recursive relation for f() is.

T(n)= T($\sqrt{n}$)+ C1 if n>2

i ignored the floor() part as it doesn’t matter here.

Let n= $2^{m}$ , T(n) = T($2^{m}$)

Let T($2^{m}$) = S(m)

S(m) = S(m/2) + C1

S(m) = O(logm)

= O(loglogn) because n=$2^{m}$

Now our original recursive function T(n)

T(n) = S(m)

=O(loglogn)

T(n)= T($\sqrt{n}$)+ C1 if n>2

i ignored the floor() part as it doesn’t matter here.

Let n= $2^{m}$ , T(n) = T($2^{m}$)

Let T($2^{m}$) = S(m)

S(m) = S(m/2) + C1

S(m) = O(logm)

= O(loglogn) because n=$2^{m}$

Now our original recursive function T(n)

T(n) = S(m)

=O(loglogn)

9,270 questions

3,204 answers

14,751 comments

96,304 users