complexity theory - Step Count in Algorithm -
what step count algorithm in terms of n ?
sequentialsearch(a,x,n) { i=n; [0]=x; while(a [i]!= x) = i-1 return }
please mention count each step here.thanks!
i hope looking for:
while (a[i] != x) = i-1;
worst case: scan whole array, a[n]
a[0]
= o(n)
mean case: scan half array o(n/2) = o(n)
complexity o(n)
Comments
Post a Comment