Usage examples of binary search

Posted by python dude on Stack Overflow See other posts from Stack Overflow or by python dude
Published on 2011-02-10T07:14:30Z Indexed on 2011/02/10 7:25 UTC
Read the original article Hit count: 116

Filed under:
|
|

I just realized that in my 4+ years of Java programming (mostly desktop apps) I never used the binary search methods in the Arrays class for anything practical. Not even once. Some reasons I can think of:

  1. 100% of the time you can get away with linear search, maps or something else that isn't binary search.
  2. The incoming data is almost never sorted, and making it sorted requires an extra sorting step.

So I wonder if it's just me, or do a lot of people never use binary search? And what are some good, practical usage examples of binary search?

© Stack Overflow or respective owner

Related posts about java

Related posts about arrays