Fix binary search bug
This commit is contained in:
parent
f4546a632e
commit
111705c44c
|
@ -890,7 +890,7 @@ For example, the following code finds out whether
|
||||||
|
|
||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
auto k = lower_bound(t,t+n,x)-t;
|
auto k = lower_bound(t,t+n,x)-t;
|
||||||
if (k < n) {
|
if (k < n && t[k] == x) {
|
||||||
// x found at index k
|
// x found at index k
|
||||||
}
|
}
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
|
|
Loading…
Reference in New Issue