From 3d7ce080379ac54c5e1ec5836eccb5d90fdbcda4 Mon Sep 17 00:00:00 2001 From: huihut Date: Tue, 21 May 2019 00:13:58 +0800 Subject: [PATCH] =?UTF-8?q?InsertSort=20=E7=AC=AC=E4=B8=80=E5=B1=82?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E7=BB=93=E6=9D=9F=E6=9D=A1=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/huihut/interview/issues/12#issuecomment-493734887 --- Algorithm/InsertSort.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Algorithm/InsertSort.h b/Algorithm/InsertSort.h index 40366b6b..49efa717 100644 --- a/Algorithm/InsertSort.h +++ b/Algorithm/InsertSort.h @@ -16,7 +16,7 @@ void InsertSort(vector& v) { int len = v.size(); - for (int i = 1; i < len - 1; ++i) { + for (int i = 1; i < len; ++i) { int temp = v[i]; for(int j = i - 1; j >= 0; --j) { @@ -30,4 +30,3 @@ void InsertSort(vector& v) } } } -