scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<n;j++) printf("(%d,%d)\n",i,j);
O(Program) = O(i-loop)
= O(N) * O(j-loop)
= O(N) * O(N) * O(1)
= O(N * N)
scanf("%d",&n); while (n > 1) { n = n/2; printf("%d\n",n); }
O(Program) = O(while-loop)
= (# times loop is executed) * O(1)
2**K <= N < 2**(K+1) where K is the integer part of log base 2 of N.
= log N * O(1)
= O(log N)