mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 01:09:40 +08:00
Format docs (#7821)
* Reformat docs for odd_even_sort.py * Fix docstring formatting * Apply suggestions from code review Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com> Co-authored-by: Caeden Perelli-Harris <caedenperelliharris@gmail.com>
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
"""
|
||||
This is a pure Python implementation of the merge sort algorithm
|
||||
This is a pure Python implementation of the merge sort algorithm.
|
||||
|
||||
For doctests run following command:
|
||||
python -m doctest -v merge_sort.py
|
||||
or
|
||||
@ -10,7 +11,7 @@ python merge_sort.py
|
||||
|
||||
|
||||
def merge_sort(collection: list) -> list:
|
||||
"""Pure implementation of the merge sort algorithm in Python
|
||||
"""
|
||||
:param collection: some mutable ordered collection with heterogeneous
|
||||
comparable items inside
|
||||
:return: the same collection ordered by ascending
|
||||
@ -24,7 +25,9 @@ def merge_sort(collection: list) -> list:
|
||||
"""
|
||||
|
||||
def merge(left: list, right: list) -> list:
|
||||
"""merge left and right
|
||||
"""
|
||||
Merge left and right.
|
||||
|
||||
:param left: left collection
|
||||
:param right: right collection
|
||||
:return: merge result
|
||||
|
@ -1,10 +1,15 @@
|
||||
"""For reference
|
||||
"""
|
||||
Odd even sort implementation.
|
||||
|
||||
https://en.wikipedia.org/wiki/Odd%E2%80%93even_sort
|
||||
"""
|
||||
|
||||
|
||||
def odd_even_sort(input_list: list) -> list:
|
||||
"""this algorithm uses the same idea of bubblesort,
|
||||
"""
|
||||
Sort input with odd even sort.
|
||||
|
||||
This algorithm uses the same idea of bubblesort,
|
||||
but by first dividing in two phase (odd and even).
|
||||
Originally developed for use on parallel processors
|
||||
with local interconnections.
|
||||
|
Reference in New Issue
Block a user