MCPcopy Create free account
hub / github.com/BeeBombshell/Python-DSA / mergesort

Method mergesort

Sort-all/merge.py:3–7  ·  view source on GitHub ↗
(A)

Source from the content-addressed store, hash-verified

1class Solution:
2 def sortArray(self, N: List[int]) -> List[int]:
3 def mergesort(A):
4 LA = len(A)
5 if LA == 1: return A
6 LH, RH = mergesort(A[:LA//2]), mergesort(A[LA//2:])
7 return merge(LH,RH)
8
9 def merge(LH, RH):
10 LLH, LRH = len(LH), len(RH)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected