Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 정렬
- 백준
- 리덕스장바구니
- 타입스크립트
- react
- error
- Operating System
- 토이프로젝트
- Java
- 공부
- codeup
- 프로그래머스
- 파이썬
- 알고리즘
- react-redux
- Redux
- 기초100제
- C++
- OS
- Spring
- 스프링
- 협업
- 일상
- memory
- 자료구조
- 코드업
- 분할메모리할당
- web
- CPU 스케줄링
- js to ts
Archives
- Today
- Total
감자튀김 공장🍟
[python] 셸 정렬(Shell sort) 본문
반응형
내용 정리 ➡ https://good-potato.tistory.com/40
[C++] 쉘 정렬 (Shell Sort)
쉘 정렬 쉘 정렬은 삽입 정렬의 O(n^2)보다 빠르다. 셀 정렬은 정렬해야할 리스트를 일정한 기준에 따라 분류하여 연속적이지 않은 여러 개의 부분 리스트를 만들고, 각 부분 리스트를 삽입 정렬
good-potato.tistory.com
코드 정리
# 쉘 정렬
def shell(arr):
n = len(arr)
h = n // 2
while h > 0:
for i in range(h, n):
j = i - h
tmp = arr[i]
while j >= 0 and arr[j] > tmp:
arr[j + h] = arr[j]
j -= h
arr[j + h] = tmp
h //= 2
반응형
'Algorithm > 정렬' 카테고리의 다른 글
[python] 합병 정렬(Merge sort) (0) | 2022.03.25 |
---|---|
[python] 퀵 정렬(Quick sort) (0) | 2022.03.23 |
[python] 삽입 정렬(Insertion sort) (0) | 2022.03.21 |
[python] 선택 정렬(Selection sort) (0) | 2022.03.20 |
[python] 버블 정렬(Bubble sort) (0) | 2022.03.19 |
Comments