- Joined
- May 11, 2022
- Messages
- 60
- Reaction score
- 6
Python:
import random
def mergeSort(N,low,high):
if low == len(N)-1:
return
if high - low == 1:
if N[high] <N[low]:
N[high], N[low] = N[low], N[high]
return
if high - low == 0:
return
mergeSort(N,low,(low+high)//2)
mergeSort(N,(low+high)//2,high)
for i in range(low,high):
j = i
while j >low and N[j] < N[j-1]:
N[j], N[j-1] =N[j-1],N[j]
j -= 1