next up previous
Next: Recursively apply partitioning in Up: Jump Search Previous: Jump Search

Jump Search (Divide and Conquer:)

Scan every ith entry of L for a fixed i. Suppose you have established that

displaymath172

then sequentially search tex2html_wrap_inline178 .

displaymath180

because there are tex2html_wrap_inline182 partitions, and there are (i-1) items to search sequentially within a partition.
eg. i=4, W(n)=n/4+3
i=10,W(n)=n/10+9
i=100,W(n)=n/100+99
but still O(n) for fixed i.

How about i depending n?

eg. tex2html_wrap_inline200

displaymath177

better than O(n) of seq search.
( tex2html_wrap_inline204 )

eg. tex2html_wrap_inline206
tex2html_wrap_inline208
tex2html_wrap_inline210
better than tex2html_wrap_inline212 .

eg. tex2html_wrap_inline214
tex2html_wrap_inline216
tex2html_wrap_inline218
Let us minimize for i,
W(n)=n/i+i-1
tex2html_wrap_inline224
set to 0 and solve, gives tex2html_wrap_inline206 .
Hence tex2html_wrap_inline230 is the best possible with the approach.



Sushil Prasad
Thu May 13 13:13:06 EDT 1999