get a range of objects with binary search
        Posted  
        
            by Behrooz
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Behrooz
        
        
        
        Published on 2010-06-11T07:38:20Z
        Indexed on 
            2010/06/11
            7:43 UTC
        
        
        Read the original article
        Hit count: 276
        
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.
© Stack Overflow or respective owner