Merge Sort is a divide-and-conquer algorithm that recursively divides the input array in half, sorts each half, and then merges the two halves back together in sorted order.
Here's the Python code for implementing Merge Sort:
main.py1025 chars33 lines
To use this function to sort an array, simply call merge_sort(your_array)
. The original array will be sorted in-place.
gistlibby LogSnag