mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-09-29 17:08:49 +08:00
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:
co-authored by
github-actions
parent
25946e4570
commit
4d0a8f2355
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user