Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Searching/Binary_Search_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
//Author: goyaldhara
#include<bits/stdc++.h>
using namespace std;
int Binary_Search(int arr[],int start,int end,int key)
int Binary_Search(int arr[],int first,int last,int key)
{
// This function will return 1 if the key is found in the array, else it will return 0;
while(start<=end)
{
int mid=(start)+(end-start)/2;
int mid=(first)+(last-first)/2;
if(arr[mid] == key)
return 1;
if(arr[mid] < key)
Expand All @@ -32,4 +32,4 @@ int main()
cout<<Binary_Search(arr,0,n-1,key)<<'\n';

return 0;
}
}