| 1 | class Solution: |
| 2 | def sortArray(self, N: List[int]) -> List[int]: |
| 3 | def insertion_sort(A): |
| 4 | for i in range(1,len(A)): |
| 5 | for j in range(0,i): |
| 6 | if A[i] < A[j]: |
| 7 | A.insert(j, A.pop(i)) |
| 8 | break |
| 9 | return A |
| 10 | |
| 11 | def bucketsort(A): |
| 12 | buckets, m, S = [[] for _ in range(1000)], min(A), [] |
| 13 | R = max(A) - m |
| 14 | if R == 0: return A |
| 15 | for a in A: buckets[999*(a-m)//R] |
| 16 | for b in buckets: S.extend(insertion_sort(b)) |
| 17 | return S |
| 18 | |
| 19 | return bucketsort(N) |
| 20 |
nothing calls this directly
no outgoing calls
no test coverage detected