welcome, and
所在版块:求学狮城 发贴时间:2003-07-29 10:57

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
B[i] records the A's interval ID(the index, not the real value).
and B's size is not necesarily to be 64, say, can be 200.

if B[i]=B[i+1], then B[i] is the value u want.
otherwise B[i+1]>B[i], you may just sub-divide the range [i/64, (i+1)/64).
Otherwise, you can just do a liear scan from A[B[i]] to A[B[i+1]],
the expect number of intervals tp be scanned
should be very small (O(1)). The worst case can be large as larger as
A's size (you can do a binary search again (O(lgn)),
but the overhead will be large).

Yup, A is random and sorted in increasing order?!, if u want to find
the right interval by comparison, the worst case bound is O(lgn), and
hard to improve. :)
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

Put your OWN COOL signature here!
 相关帖子 我要回复↙ ↗回到正文
searching algorithm enquiry wangye   (596 bytes , 331reads )
er, sc2   (582 bytes , 280reads )
thanx very much for sc2's suggestion, but wangye   (415 bytes , 217reads )
welcome, and sc2   (677 bytes , 169reads )
不好意思的说,可能是我太笨了 wangye   (122 bytes , 168reads )
we discuss it with email bah sc2   (35 bytes , 154reads )
no problem wangye   (21 bytes , 190reads )