int Binary_search()
{
string word;
cout << "Enter The Word You Want To Find : ";
cin >> word;
int start = 0, end = data.size() - 1;
int mid, i = 0, counter = 0;
while (start <= end)
{
mid = (end + start) / 2;
if (data[i] == word)
return i;
else if (data[i] > word)
end = mid - 1;
else
start = mid + 1;
counter++;
i++;
}
return -1;
}
if i wanna to know how much time this code would take to find a word in data
which is a vector of type string
and it loaded with words.