From 111705c44c680f477b04d36d456885cd678c1833 Mon Sep 17 00:00:00 2001 From: Antti H S Laaksonen Date: Fri, 12 May 2017 10:43:11 +0300 Subject: [PATCH] Fix binary search bug --- chapter03.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter03.tex b/chapter03.tex index f224366..c95f29b 100644 --- a/chapter03.tex +++ b/chapter03.tex @@ -890,7 +890,7 @@ For example, the following code finds out whether \begin{lstlisting} auto k = lower_bound(t,t+n,x)-t; -if (k < n) { +if (k < n && t[k] == x) { // x found at index k } \end{lstlisting}