From bb70803c9ee89c1e18456756727c372e7f9f8d2c Mon Sep 17 00:00:00 2001 From: yyeltsyn Date: Fri, 2 Sep 2016 13:59:46 +0300 Subject: [PATCH] Update heap_sort.py --- sorts/heap_sort.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sorts/heap_sort.py b/sorts/heap_sort.py index 822bb6631..f89ae1866 100644 --- a/sorts/heap_sort.py +++ b/sorts/heap_sort.py @@ -7,7 +7,7 @@ or python3 -m doctest -v heap_sort.py For manual testing run: -python insertion_sort.py +python heap_sort.py ''' from __future__ import print_function @@ -46,7 +46,7 @@ def heap_sort(unsorted): n = len(unsorted) for i in range(n//2 - 1, -1, -1): heapify(unsorted, i, n) - for i in range(n - 1, -1, -1): + for i in range(n - 1, 0, -1): unsorted[0], unsorted[i] = unsorted[i], unsorted[0] heapify(unsorted, 0, i) return unsorted