int k=1;
while (k<n){
k=k+C
}
It takes steps (n-1)/C: write u = (k-1) / C. Then k = Cu + 1, and the statement becomes
u=0;
while(u < (n-1)/C) {
u=u+1
}
Hence the while loop O(n)(since it is Cconstant)
EDIT: let me try to explain it the other way around.
Start with a dummy variable u. Cycle
u=0;
while(u < MAX) {
u = u+1
}
runs over MAXtime.
When you give a MAX = (n-1) / Cloop
u=0;
while(u < (n-1)/C) {
u=u+1
}
And it works (n-1)/Conce.
u < (n-1)/C C*u < n-1 C*u + 1 < n,
u=0;
while(C*u + 1 < n) {
u=u+1
}
, k = C * u + 1. ,
u=0;
k=1; // C * 0 + 1 = 1
while(C*u + 1 < n) {
while(k < n) {
u=u+1
k=k+C //C * (u+1) + 1 = C * u + 1 + C = old_k + C
:
int k=1;
while (k<n){
k=k+C
}
(n-1)/C.