Hi. I learned the big O notation in class, but I still don't understand it. I have a test coming up and I was wondering if anybody could tell me how it is done. I have examples which my teacher gave us to practice on. I will post a few here and please could you tell me what I have to do and any tips and tricks?
Question
saiz66
Hi. I learned the big O notation in class, but I still don't understand it. I have a test coming up and I was wondering if anybody could tell me how it is done. I have examples which my teacher gave us to practice on. I will post a few here and please could you tell me what I have to do and any tips and tricks?
a) for(j =0; j<=n, j+=2)
printf("Hello\n");
for (k=n-1; k>1; k-=3)
printf("Good Bye\n");
c) for(i=1; i<=n; i+=3)
for(j=i; i<= i+5; ++i)
sum++;
for(k=n; k>=0; --k)
printf("Result = %d\n", sum-k);
Link to comment
Share on other sites
20 answers to this question
Recommended Posts