What is the average number of comparisons in a sequential search?



f(n)= 1.Pn + 2.Pn + 3.Pn +…+ N.Pn
where
Pn = 1/N
f(n)= 1.1/N +2.1/N + 3.1/N+….+N.1/N
= (1+2+3+….+N)1/N
= N(N+1)/2N
= (N+1)/2




Explore posts in the same categories: Data Structure Interview Questions


BOOKMARK THIS : BlinkList | del.icio.us | Digg it | Furl | reddit | StumbleUpon | Yahoo MyWeb |


Comments are closed.