sort1 백준 2750 - 정렬 알고리즘 (Bubble/Selection/Insertion Sort Algorithm) Bubble Sort 시간복잡도: O(N^2) n = int(input()) numbers = list() for _ in range(n): numbers.append(int(input())) # Bubble Sort for i in range(n): for j in range(n-1): if numbers[j] > numbers[j+1]: numbers[j], numbers[j+1] = numbers[j+1], numbers[j] # for i in range(n): # for j in range(n): # if numbers[i] < numbers[j]: # numbers[i], numbers[j] = numbers[j], numbers[i] for i in numbers: print(i) Selec.. 2022. 5. 19. 이전 1 다음