Computer Science, asked by bhargavireddy753, 4 months ago

write a general algorithm for binary search​

Answers

Answered by chhaviramsharma9564
0

Explanation:

Binary Search Algorithm

  • Start with the middle element: If the target value is equal to the middle element of the array, then return the index of the middle element. If not, then compare the middle element with the target value, ...
  • When a match is found, return the index of the element matched.
  • If no match is found, then return -1.
Answered by aaryaraj1037
1

Explanation:

Start with the middle element: If the target value is equal to the middle element of the array, then return the index of the middle element. If not, then compare the middle element with the target value, ...

When a match is found, return the index of the element matched.

If no match is found, then return -1.

hope it helps you......

Similar questions