Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

A superior binary search method

Revision en1, by ripbozo, 2022-11-07 19:40:45
int L = 0, R = 0;
while(L < R){
    if(v[L] == x) cout << "I found it";
    if(v[R] == x) cout << "I found it";

    L++, R--;
}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ripbozo 2022-11-07 19:40:45 185 Initial revision (published)