How to calculate time complexiy of the following line of code using 'Big-O' or 'Big-OH' notation???
1. scanf("%d",&n);
2. for(i=1,m=n+66;i<=m;i++)
3. printf("%d \n",i);
4. for(j=n/21,m=n/5;j<=m;j++)
5. printf("%d \n",j);
I have basic idea but i am getting confused...So, please help me to calculate time complexity of each step,
plus overall complexity.
i have gone through some books and sites but, the explanation is very complex......:(
And according to me the time comlexity of each step is,
1. 1
2. 1+1+(m+1)+(m) // may be true or not
3. 1
4. O(log n) // i know this is wrong
5. 1
PLEASE, correct my answer...