From 74a8bedb3ddf11bad1f01618e674fa0ee2af59c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E7=A3=8A?= Date: Tue, 16 Oct 2018 17:26:02 +0800 Subject: [PATCH] InsertSort --- go/11_sorts/Sort.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go/11_sorts/Sort.go b/go/11_sorts/Sort.go index 379c41b..628cbde 100644 --- a/go/11_sorts/Sort.go +++ b/go/11_sorts/Sort.go @@ -27,6 +27,8 @@ func InsertSort(a []int) { for ; j >= 0; j-- { if a[j] > v { a[j+1] = a[j] + } else { + break } } a[j+1] = v