I'm task to solve a problem in UVA and its problem 305 in particular well its easy to program it just brute forcing stuff. Part of the task is to find the big Oh of the program using frequency count
#include<stdio.h>
const int goodjoseph[] = {2,7,5,30,169,441,1872,7632,1740,93313,459901,1358657,2504881};
char k;
int main(void){
while(scanf("%u",&k) && k){
printf("%u",k);
printf("%d\n",goodjoseph[k-1]);
}
return 0;
}
from school we were taught basics of frequency count like
int x=1; ---- 1
while ( x<=n) ---- n-x+2 = n+1
x = x + 1; ---- n
Total = 2n+2 thus having big o(n);
can you help me find the frequency count for
while(scanf("%u",&k) && k){