Seaching Algorithms

This commit is contained in:
2023-11-12 19:18:10 +05:30
commit 1abfa41674
4 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
//Binary Search Normal
int low = 0 , high = n , ans;
while( low <= high ){
int mid = low + ( high - low)/2;
if( check(mid) ){
ans = mid;
low = mid + 1;
}
else{
high = mid - 1;
}
}