sort
-
정렬 알고리즘(Sort Algorithm) 모음(Python, 파이썬)카테고리 없음 2019. 1. 21. 13:09
삽입 정렬(Insertion Sort) 123456789def insertionSort(x): for size in range(1,len(x)): val = x[size] i = size while i > 0 and x[i-1] > val: x[i] = x[i-1] i-= 1 x[i] = val return xcs버블 정렬(Bubble Sort)123456def bubbleSort(x): for size in reversed(range(len(x))): for i in range(size): if x[i] > x[i+1]: x[i], x[i+1] = x[i+1], x[i] return xColored by Color Scriptercs선택 정렬(Selection Sort)123456789def selec..