Skip to content

Commit cb0cea0

Browse files
author
Shreya
committed
Improve pancake_sort docstring
1 parent 1fc9bc0 commit cb0cea0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

sorts/pancake_sort.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
def pancake_sort(arr: MutableSequence[int]) -> MutableSequence[int]:
1717
"""Sort Array with Pancake Sort.
18-
:param arr: Collection containing comparable items
19-
:return: Collection ordered in ascending order of items
18+
:param arr: Mutable sequence containing comparable items.
19+
:return: The same sequence sorted in ascending order.
2020
Examples:
2121
>>> pancake_sort([0, 5, 3, 2, 2])
2222
[0, 2, 2, 3, 5]
@@ -25,8 +25,11 @@ def pancake_sort(arr: MutableSequence[int]) -> MutableSequence[int]:
2525
>>> pancake_sort([-2, -5, -45])
2626
[-45, -5, -2]
2727
28-
Time Complexity: O(n^2)
29-
Space Complexity: O(n)
28+
Time Complexity:
29+
O(n^2)
30+
31+
Space Complexity:
32+
O(n)
3033
"""
3134
cur = len(arr)
3235
while cur > 1:

0 commit comments

Comments
 (0)