From 0e558b748babb5528a6890c36af8a5f83d8b6b3b Mon Sep 17 00:00:00 2001 From: kiwipi Date: Mon, 24 Aug 2015 09:20:14 +0800 Subject: [PATCH] Update sorting.py pep8 check --- 2-Sorting/sorting.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/2-Sorting/sorting.py b/2-Sorting/sorting.py index 09540d4..8f01981 100644 --- a/2-Sorting/sorting.py +++ b/2-Sorting/sorting.py @@ -27,7 +27,7 @@ def insertion_sort(arr): while pos > 0 and arr[pos-1] > cursor: # Swap the number down the list arr[pos] = arr[pos-1] - pos = pos-1 + pos = pos - 1 # Break and do the final swap arr[pos] = cursor return arr @@ -52,15 +52,15 @@ def merge(left, right): Complexity: O(n) """ arr = [] - left_cursor, right_cursor = 0,0 + left_cursor, right_cursor = 0, 0 while left_cursor < len(left) and right_cursor < len(right): # Sort each one and place into the result if left[left_cursor] <= right[right_cursor]: arr.append(left[left_cursor]) - left_cursor+=1 + left_cursor += 1 else: arr.append(right[right_cursor]) - right_cursor+=1 + right_cursor += 1 # Add the left overs if there's any left to the result if left: arr.extend(left[left_cursor:])