From 23d128b2f5d96c02a0caa9a0a2594ddc95ba2b92 Mon Sep 17 00:00:00 2001 From: marioepugh Date: Wed, 9 Oct 2019 20:18:36 -0700 Subject: [PATCH 1/2] Update BubbleSort.py --- BubbleSort.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BubbleSort.py b/BubbleSort.py index 91b2b97..a0f99a5 100644 --- a/BubbleSort.py +++ b/BubbleSort.py @@ -14,4 +14,5 @@ def bubble_sort(list): is_sorted = True return sorted_list -print(bubble_sort([2, 1, 3])) \ No newline at end of file +print(bubble_sort([2, 1, 3])) +00 From aa96e707e28980b762ed850e32a03dca2ae00559 Mon Sep 17 00:00:00 2001 From: marioepugh Date: Thu, 10 Oct 2019 10:54:06 -0700 Subject: [PATCH 2/2] Update BubbleSort.py Modified the code so that it now sorts from high to low. --- BubbleSort.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BubbleSort.py b/BubbleSort.py index a0f99a5..2df6918 100644 --- a/BubbleSort.py +++ b/BubbleSort.py @@ -4,7 +4,7 @@ def bubble_sort(list): while is_sorted == False: swaps = 0 for i in range(len(list) - 1): - if sorted_list[i] > sorted_list[i + 1]: # swap + if sorted_list[i] < sorted_list[i + 1]: # swap temp = sorted_list[i] sorted_list[i] = sorted_list[i + 1] sorted_list[i + 1] = temp @@ -15,4 +15,4 @@ def bubble_sort(list): return sorted_list print(bubble_sort([2, 1, 3])) -00 +