You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include <bits/stdc++.h> // C++ code for task 6
using namespace std;
int main() {
int n = 5, L[] = {10, 7, 5, 20, 8}, v = 7;
sort(L, L+n);
printf("%d\n", binary_search(L, L+n, v)); // should be index 1
** it returns boolean, not index**
}
The text was updated successfully, but these errors were encountered:
#include <bits/stdc++.h> // C++ code for task 6
using namespace std;
int main() {
int n = 5, L[] = {10, 7, 5, 20, 8}, v = 7;
sort(L, L+n);
printf("%d\n", binary_search(L, L+n, v)); // should be index 1
}
The text was updated successfully, but these errors were encountered: