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,15 @@
//Advanced Binary Seach.
int max_iter;
double low , high , ans;
double err ;
for(int i = 1 ; i <= max_iter ; i++ ){
double mid = low + (high - low)/2;
if( check(mid) ){
ans = mid;
low = mid + err;
}
else{
high = mid - err;
}
}