김호쭈
DevForYou
김호쭈
전체 방문자
오늘
어제
  • 분류 전체보기 (321)
    • • 데이터베이스(DB) (9)
      • __SQL__ (9)
    • •알고리즘(Algorithm ) (117)
      • 문제풀이 (99)
      • 스터디 (14)
      • 알고리즘 팁 (4)
    • •Compter Science (57)
      • Operating System (25)
      • Computer Network (1)
      • Computer Vision (16)
      • Artificial Intelligence (14)
      • Software Technology (1)
    • • 독서 (36)
      • Design Pattern (24)
      • 객체지향의 사실과 오해 (1)
      • Object Oriented Software En.. (11)
    • • 개발 (26)
      • React (3)
      • node.js (6)
      • Django (11)
      • Spring boot (6)
    • • 개발Tip (4)
      • GitHub (0)
    • •프로젝트 (2)
      • 물물 (2)
    • •App (54)
      • 안드로이드 with Kotlin (50)
      • 코틀린(Kotiln) (4)
    • •회고 (8)
    • •취준일기 (3)
    • • 기타 (2)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • local저장소
  • 깃허브데스크탑
  • GitHubDesktop
  • 로컬저장소
  • ㄱ
  • 원격저장소
  • Remote저장소
  • KMU_WINK

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
김호쭈

DevForYou

•알고리즘(Algorithm )/스터디

[알고리즘] 삽입정렬 파이썬

2022. 7. 22. 18:17

# 참고

 

Sorting (Bubble, Selection, Insertion, Merge, Quick, Counting, Radix) - VisuAlgo

VisuAlgo is free of charge for Computer Science community on earth. If you like VisuAlgo, the only "payment" that we ask of you is for you to tell the existence of VisuAlgo to other Computer Science students/instructors that you know =) via Facebook/Twitte

visualgo.net

 

# 코드

def insertion_sort(input):
  data = input
  size = len(data)
  for target in range(1, size):
    copy_target = data[target]
    for index in range(target-1, -1, -1):
      if (copy_target < data[index]):
        data[index+1] = data[index]
        data[index] = copy_target
      else:
        break


if __name__ == '__main__':
  input = [10,9,8,7,6,5,4,3,2,1,0]
  insertion_sort(input)
  print(input)

# 시간복잡도

O(n^2)

저작자표시 (새창열림)

'•알고리즘(Algorithm ) > 스터디' 카테고리의 다른 글

[알고리즘] 병합정렬(merge-sort) 파이썬  (0) 2022.07.24
[알고리즘] 재귀함수 파이썬, 회문검사  (0) 2022.07.23
[알고리즘] 선택 정렬 파이썬  (0) 2022.07.22
[알고리즘] 버블정렬 파이썬  (0) 2022.07.22
[정렬] 버블정렬(Bubble Sort) 알고리즘  (0) 2021.05.21
    '•알고리즘(Algorithm )/스터디' 카테고리의 다른 글
    • [알고리즘] 재귀함수 파이썬, 회문검사
    • [알고리즘] 선택 정렬 파이썬
    • [알고리즘] 버블정렬 파이썬
    • [정렬] 버블정렬(Bubble Sort) 알고리즘
    김호쭈
    김호쭈
    공부하고 정리하고 기록하기

    티스토리툴바