Currently we do a nice binary search for ids when looking for a record.  
But we can do a little better than that.  Suppose we're looking for id N.  
We can easily find out what the biggest id is, call it M.  Let K be the
number of records. Then, because the ids are numerical, we can just do our
binary search over the index range max(1,K-(M-N)) to min(K,1+N), which
will at least sometimes be a smaller range than 1 to K.  (If the ids are
assigned sequentially, then in fact we will hit right on the index!)

--
Dr. Alexander R. Pruss  || e-mail: [EMAIL PROTECTED]
Philosophy Department   || online papers and home page:
Georgetown University   ||  www.georgetown.edu/faculty/ap85
Washington, DC 20057    ||
U.S.A.                  ||
-----------------------------------------------------------------------------
   "Philosophiam discimus non ut tantum sciamus, sed ut boni efficiamur."
       - Paul of Worczyn (1424)

_______________________________________________
plucker-dev mailing list
[EMAIL PROTECTED]
http://lists.rubberchicken.org/mailman/listinfo/plucker-dev

Reply via email to