Skip to Content
똑똑한 코드 작성을 위한 실전 알고리즘
book

똑똑한 코드 작성을 위한 실전 알고리즘

by 조지 하이네만, 윤대석
May 2022
Beginner to intermediate
296 pages
5h 54m
Korean
Hanbit Media, Inc.
Content preview from 똑똑한 코드 작성을 위한 실전 알고리즘
180
똑똑한 코드 작성을 위한 실전 알고리즘
에서 흰색과 회색 음영을 번갈아 사용해 나타냈다.
N
/
size
개의 정렬된 하위 배열이 생긴다 (원
본 배열의 길이가
size
로 나누어지지 않을 경우 하나가 더 생긴다 ). 앞서 값
size
개를 정렬하
는 런타임 성능은
size
×
(
size
-
1
)/
2
에 정비례함을 보았다. 이는
N
/
size
회 발생하므로 총
런타임 성능은
N
×
(
size
-
1
)/
2
에 정비례한다.
size
는 상수로 간주하므로 해당 초기 단계는
O
(
N
)으로 분류된다.
두 번째 단계에서는 이웃하는
run
9
의 쌍을 병합한다.
5
.
6
절 ‘병합 정렬’에서 설명했듯
merge
()
의 총 실행 횟수는
N
에 비례한다..
while
루프의 첫 번째 순회 후에 정렬된 하위 배열
의 크기는 [그림
5
-
15
]에서 음영 처리된 영역으로 볼 수 있듯 두 배가 되어
8
이 된다. 예제에
서는
3
회 순회하며
size
는 계속해서 두 배가 되어
4
부터
32
까지 (
32
N
보다 크다 ) 커진다.
일반적으로는 정렬된 하위 배열의 크기
size
에서 시작해
while
루프를
size
×
2
k
>
N
일 때까
k
회 순회한다. 이 계산은
2
k
>
N
/
size
로도 쓴다.
k
를 찾기 위해 양쪽에 로그를 취하면
k
log
(
N
/
size
)가 된다.
log
(
a
/
b
)=
log
(
a
)-
log
(
b
)
이므로
k
>
log ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

데이터 익명화를 위한 파이프라인

데이터 익명화를 위한 파이프라인

루크 아버클, 칼리드 엘 에맘
개발 7년차, 매니저 1일차

개발 7년차, 매니저 1일차

권원상, 한민주, 카미유 푸르니에

Publisher Resources

ISBN: 9791162245644