Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is binary search used in practice?

Every programmer is taught that binary search is a good, fast way to search an ordered list of data. There are many toy textbook examples of using binary search, but what about in real programming: where is binary search actually used in real-life programs?

like image 781
tjdonaldson Avatar asked Feb 12 '09 05:02

tjdonaldson


People also ask

Where is binary search used in real life?

There are plenty of algorithmic tasks that require a binary search to achieve a model solution. They appear during technical recruiting interviews, in a code test, in exams, and in code challenges.

Where do I use binary search and why?

In its simplest form, binary search is used to quickly find a value in a sorted sequence (consider a sequence an ordinary array for now). We'll call the sought value the target value for clarity. Binary search maintains a contiguous subsequence of the starting sequence where the target value is surely located.

Are binary search trees used in real life?

Binary Tree is one of the most used Tree Data Structure and is used in real life Software systems. Following are the Applications of Binary Tree: Binary Tree is used to as the basic data structure in Microsoft Excel and spreadsheets in usual. Binary Tree is used to implement indexing of Segmented Database.


1 Answers

Binary search is used everywhere. Take any sorted collection from any language library (Java, .NET, C++ STL and so on) and they all will use (or have the option to use) binary search to find values. While true that you have to implement it rarely, you still have to understand the principles behind it to take advantage of it.

like image 173
Grey Panther Avatar answered Nov 07 '22 12:11

Grey Panther