-
자료구조 - 시간복잡도자료구조 2024. 9. 13. 21:22
시간복잡도 는 (시간이 얼마나 걸리냐)
알고리즘을 평가하는 척도중 하나입니다.
입력값(n)과 연산수행시간의 상관관계를 나타내는 척도를 시간복잡도라고 합니다.
연산수행시간은 사용하는 프로그램 언어마다 컴퓨터마다 다르기 때문에 (애매해져서)
(ex. 똑같은 알고리즘이라도 슈퍼컴퓨터는 빠르고, 느린컴퓨터는 느려서)
연산횟수를 기준으로 시간복잡도를 계산합니다
공간 복잡도 (계산하기 애매해서 계산잘안함)
프로그램 실행에 얼마나 많은 메모리를 나타낸다.
피보나치 수열
알고리즘 1번 : 계산할때마다 기록함(메로리사용)
알고리즘 2번: 계산하고 기록안함(메모리 사용안함)
O notation - 시간복잡도와 관련
N개의 데이터
데이터의 개수에 따라 실행되는 연산의 양
알고리즘을 어떻게 짜느냐에 따라
'자료구조' 카테고리의 다른 글
최소 신장 트리 (Minimum Spanning Tree) (0) 2024.10.01 자료구조- 해시 테이블 (Hash Table) (0) 2024.09.26 정렬 알고리즘 - 버블 정렬(Bubble Sort) (0) 2024.09.15 정렬알고리즘- 삽입정렬(Insertion Sort) (0) 2024.09.15 정렬 알고리즘 - 선택정렬 selection sort (0) 2024.09.13