get a range of objects with binary search
- by Behrooz
I have some data like this:
ID Value
1 AAA
1 ABC
2 dasd
2 dsfdsf
2 dsfsd
3 df
3 dwqef
they are objects(not plain text).
and i want to get all objects with the ID = 2.
I can do a binary binary search and get the index 3,but how can i get (2 and 4) is there any efficient algorithm?
the real problem has lists with about one Million items.
any language except bf and lisp can help.