Optimized recursive_bubble_sort (#2410)

* optimized recursive_bubble_sort

* Fixed doctest error due whitespace

* reduce loop times for optimization

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
Du Yuanchao
2020-09-10 10:31:26 +02:00
committed by GitHub
co-authored by github-actions
parent 25946e4570
commit 4d0a8f2355
60 changed files with 900 additions and 859 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ def dis_between_closest_in_strip(points, points_counts, min_dis=float("inf")):
def closest_pair_of_points_sqr(points_sorted_on_x, points_sorted_on_y, points_counts):
""" divide and conquer approach
"""divide and conquer approach
Parameters :
points, points_count (list(tuple(int, int)), int)
+3 -3
View File
@@ -11,7 +11,7 @@ Ref : INTRODUCTION TO ALGORITHMS THIRD EDITION
def max_sum_from_start(array):
""" This function finds the maximum contiguous sum of array from 0 index
"""This function finds the maximum contiguous sum of array from 0 index
Parameters :
array (list[int]) : given array
@@ -30,7 +30,7 @@ def max_sum_from_start(array):
def max_cross_array_sum(array, left, mid, right):
""" This function finds the maximum contiguous sum of left and right arrays
"""This function finds the maximum contiguous sum of left and right arrays
Parameters :
array, left, mid, right (list[int], int, int, int)
@@ -46,7 +46,7 @@ def max_cross_array_sum(array, left, mid, right):
def max_subarray_sum(array, left, right):
""" Maximum contiguous sub-array sum, using divide and conquer method
"""Maximum contiguous sub-array sum, using divide and conquer method
Parameters :
array, left, right (list[int], int, int) :
@@ -29,7 +29,9 @@ def matrix_subtraction(matrix_a: List, matrix_b: List):
]
def split_matrix(a: List,) -> Tuple[List, List, List, List]:
def split_matrix(
a: List,
) -> Tuple[List, List, List, List]:
"""
Given an even length matrix, returns the top_left, top_right, bot_left, bot_right
quadrant.