How to write an example of O(log(log n)) time complexity in C

1 Answer

0 votes
#include <stdio.h>
#include <math.h>
 
// O(log(log n)) Growing (or shrinking ) by a Square Root

void main()
{
    int n = 16;
     
    for (int i = 2; i <= n; i = pow(i, 2)) {
        printf("%3d C Programming\n", i);
    }
}
   
   
    
/* 
run:
    
  2 C Programming
  4 C Programming
 16 C Programming
    
*/

 



answered Dec 12, 2024 by avibootz
edited Dec 12, 2024 by avibootz

Related questions

1 answer 114 views
1 answer 114 views
1 answer 106 views
1 answer 103 views
1 answer 110 views
1 answer 66 views
3 answers 118 views
...