Skip to content

Commit 00e30c0

Browse files
committed
change __doc__
1 parent 975dd48 commit 00e30c0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

sortingx/sorting.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
def bubble(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
2121
'''
22-
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported.
22+
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
2323
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
2424
:param reverse: whether to use descending order. The default is ascending order.
2525
'''
@@ -37,21 +37,21 @@ def bubble(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
3737

3838
def insert(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
3939
'''
40-
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported.
40+
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
4141
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
4242
:param reverse: whether to use descending order. The default is ascending order.
4343
'''
4444
compare = generate(array, key)
4545
for index in range(1, len(array)):
4646
keyc, keya = compare[index], array[index]
4747
low, high = 0, index - 1
48-
while low <= high: # 符合单调性的序列
48+
while low <= high: # sequence conforming to monotonicity
4949
mid = (low + high) // 2
5050
if core(keyc, compare[mid], key, reverse):
5151
low = mid + 1
5252
else:
5353
high = mid - 1
54-
for pre in range(index, low, -1): # 从后往前
54+
for pre in range(index, low, -1): # from back to front
5555
array[pre] = array[pre - 1]
5656
if key != None:
5757
compare[pre] = compare[pre - 1]
@@ -61,7 +61,7 @@ def insert(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
6161

6262
def shell(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
6363
'''
64-
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported.
64+
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
6565
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
6666
:param reverse: whether to use descending order. The default is ascending order.
6767
'''
@@ -82,14 +82,14 @@ def shell(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
8282

8383
def heap(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
8484
'''
85-
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported.
85+
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
8686
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
8787
:param reverse: whether to use descending order. The default is ascending order.
8888
'''
8989
compare = generate(array, key)
9090
def build(root: int, end: int) -> None:
9191
'''
92-
root: 指示根节点的游标(整型), end: 指示数组末尾的游标(整型)
92+
Root: cursor indicating the root node (integer), end: cursor indicating the end of the array (integer)
9393
'''
9494
piv = root
9595
left = 2 * root + 1
@@ -115,14 +115,14 @@ def build(root: int, end: int) -> None:
115115

116116
def quick(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
117117
'''
118-
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported.
118+
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
119119
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
120120
:param reverse: whether to use descending order. The default is ascending order.
121121
'''
122122
compare = generate(array, key)
123123
def solve(l: int, r: int) -> None:
124124
'''
125-
算法主体
125+
main
126126
'''
127127
if l < r:
128128
mid = partition(l, r)
@@ -131,7 +131,7 @@ def solve(l: int, r: int) -> None:
131131

132132
def partition(l: int, r: int) -> int:
133133
'''
134-
array: 数据(列表), l: 数据左侧游标(整型), r: 数据右侧游标(整型)
134+
l: The left cursor of array (integer), r: The right cursor of array (integer)
135135
'''
136136
val = compare[r]
137137
index = l - 1
@@ -149,14 +149,14 @@ def partition(l: int, r: int) -> int:
149149

150150
def merge(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
151151
'''
152-
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported.
152+
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
153153
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
154154
:param reverse: whether to use descending order. The default is ascending order.
155155
'''
156156
compare = generate(array, key)
157157
def merge(low: int, mid: int, high: int) -> None:
158158
'''
159-
low: 数据低侧游标(整型), mid: 数据中间游标(整型), high: 数据高侧游标(整型)
159+
low: The low-side cursor of array (integer), mid: The middle-side cursor of array (integer), high: The high-side cursor of array (integer)
160160
'''
161161
left, lc = array[low: mid], compare[low: mid]
162162
right, rc = array[mid: high], compare[mid: high]
@@ -181,7 +181,7 @@ def merge(low: int, mid: int, high: int) -> None:
181181

182182
def solve() -> None:
183183
'''
184-
算法主体
184+
main
185185
'''
186186
i = 1
187187
while i < len(array):

0 commit comments

Comments
 (0)