1. 버블 정렬(Bubble Sort)
def sort_bubble(L:list)->list:
last = len(L) - 1
for count in range(last):
for i in range(last-count):
if L[i] > L[i + 1]:
L[i], L[i + 1] = L[i + 1], L[i]
return L
2. 삽입 정렬(Insertion Sort)
def insert_sort(L):
for i in range(1, len(L)):
for j in range(i, 0, -1):
if L[j] < L[j - 1]:
L[j - 1], L[j] = L[j], L[j - 1]
else:
break
return L
3. 병합 정렬(Merge Sort)
퀵 정렬
셸 정렬
힙 정렬
댓글