binary search is an algorithm through which we can search any element present in an array(which is sorted) by using divide and conquer approach for example
we have an array
{1,3,6,7,8,9,13,18,19}
we want to search an element 7 searching element means finding its position in the array.In binary search first we divide the array
mid = (beg+end)/2
mid will give us the mid element 8.
then we compare it with search element.
for more info on binary search refer
Binary search algorithm - Wikipedia, the free encyclopedia
for my query I feel that the error is related to :
as I am storing one arry to another using for loop.