From fc6375a039e0c8a9272cd1d758f664ff15073238 Mon Sep 17 00:00:00 2001 From: James Sherratt Date: Sun, 20 Oct 2019 22:10:25 +0100 Subject: [PATCH] Better formatting Adjusted the spacing of the functions to be more PEP friendly. --- sorting/heapsort.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sorting/heapsort.py b/sorting/heapsort.py index a06f645..478caf1 100644 --- a/sorting/heapsort.py +++ b/sorting/heapsort.py @@ -65,6 +65,7 @@ def repair_heap(vals_list, root, arr_top): root = swap left = get_left(root) right = get_right(root) + return vals_list @@ -79,6 +80,7 @@ def max_heap(vals_list): len_list = len(vals_list) for root in range(len_list//2, -1, -1): repair_heap(vals_list, root, len_list) + return vals_list @@ -97,8 +99,8 @@ def max_heap_to_sorted(vals_list): # Another way of doing this is to pass a slice of the vals_list up to the value top, but python passes # slices by copy so there's a massive performance hit. repair_heap(vals_list, 0, top) - return vals_list + return vals_list def heapsort(vals_list):