Skip to content

Add merge insertion sort #2211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from Jul 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sorts/merge_insertion_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
"""


def mergeInsertionSort(collection):
def merge_insertion_sort(collection):
"""Pure implementation of merge-insertion sort algorithm in Python

:param collection: some mutable ordered collection with heterogeneous
comparable items inside
:return: the same collection ordered by ascending

Examples:
>>> mergeInsertionSort([0, 5, 3, 2, 2])
>>> merge_insertion_sort([0, 5, 3, 2, 2])
[0, 2, 2, 3, 5]

>>> mergeInsertionSort([])
>>> merge_insertion_sort([])
[]

>>> mergeInsertionSort([-2, -5, -45])
>>> merge_insertion_sort([-2, -5, -45])
[-45, -5, -2]
"""

Expand Down Expand Up @@ -100,4 +100,4 @@ def merge(left, right):
if __name__ == "__main__":
user_input = input("Enter numbers separated by a comma:\n").strip()
unsorted = [int(item) for item in user_input.split(",")]
print(mergeInsertionSort(unsorted))
print(merge_insertion_sort(unsorted))