89.9k views
18 votes
Which example can be used to perform a binary search?

User Ahmad Saad
by
3.5k points

1 Answer

5 votes

Answer:

In any case, binary search can be used to solve more extensive scope of problem, for example, finding the next smallest or next-biggest element in an array comparative with the target regardless of whether it is present or missing in the array.

Step-by-step explanation:

In computer science, binary search, otherwise called logarithmic search, is a search calculation that finds the position of an objective incentive inside an arranged array. Binary search compares the target value to the center component of the array. In the event that they are not equivalent, the half in which the value can't lie is dispensed with and the search proceeds on the other half, again taking the center value to contrast with the target value, and continues this until the target value is found. On the off chance that the search ends with the other half being empty, the target value isn't in the array.

Binary search is quicker than linear search aside from small arrays. Nonetheless, the array should be arranged first to have the option to apply binary search. There are particular data structures intended for quick looking, for example, hash tables, that can be looked through more effectively than binary search.

User Itsundefined
by
3.6k points