diff --git a/Sorting/Merge Sort/Python/MergeSort.py b/Sorting/Merge Sort/Python/MergeSort.py new file mode 100644 index 00000000..04b04143 --- /dev/null +++ b/Sorting/Merge Sort/Python/MergeSort.py @@ -0,0 +1,68 @@ +# merge sort in python + +#first array l to m +#second array m+1 to r +def merge(arr, l, m, r): + n1 = m-l+1 + n2 = r-m + + #temp arrays + L = [0] * (n1) + R = [0] * (n2) + + for i in range(0, n1): + L[i] = arr[l+i] + + for j in range(0, n2): + R[j] = arr[m+1+j] + + i=0 + j=0 + k=l + + while i