diff --git a/divide_and_conquer/mergesort.py b/divide_and_conquer/mergesort.py new file mode 100644 index 000000000..b2a5a4c32 --- /dev/null +++ b/divide_and_conquer/mergesort.py @@ -0,0 +1,45 @@ +def merge(a,b,m,e): + l=a[b:m+1] + r=a[m+1:e+1] + k=b + i=0 + j=0 + while i>> mergesort([3,2,1],0,2) + [1, 2, 3] + >>> mergesort([3,2,1,0,1,2,3,5,4],0,8) + [0, 1, 1, 2, 2, 3, 3, 4, 5] + """ + if b