What is binary search?

Suppose that one has a very large range of objects and organizes them in some proper way in a long row. This individual can quickly find out where in a row a particular object is placed using a binary search. This search is carried out by checking the medium item in the line and if the medium object is not searched for, then only one of the half of the row where the item could be. A person would know which half would continue to look at because the items are arranged in order. These two steps are carried out again and again, on smaller and smaller halves until the item is found either or left anywhere to look. It will achieve this by comparing the known value with the designated middle element and, if not equivalent, repeatedly limits the comparison of the middle element with the enamelled half of the set until the equivalence is obtained or the list is exhausted.

binary searches forVan, sometimes called a half -interval search, is much faster than the basic sequential search that starts at one end of the list of items and compares each item along the path until the match is found or until the search reaches the end of the list. If a person had 100 items in a row and the last item was one that was searched, sequential search would compare 100. However, a bisek method requires only seven comparisons before finding an item. It is obviously much more efficient than sequential search.

The biggest disadvantage of binary search is that the list of items must be sorted for this search. Sorting list requires time. Sorting then using this type of search can take more time in the first place than to make a different type of search.

The ability to use information, especially from very large data files, is important to accomplish many tasks in life. Informatics discipline deals with many types of problems, including finding effective outsFinding information to get useful results. Binary search is just one of the many algorithms available for data search.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?