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

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

by 조지 하이네만, 윤대석
May 2022
Beginner to intermediate
296 pages
5h 54m
Korean
Hanbit Media, Inc.
Content preview from 똑똑한 코드 작성을 위한 실전 알고리즘
129
4
4.1
최대 이진 힙
이상한 아이디어처럼 보이지만 엔트리가 ‘일부만 정렬’되었다면 어떨까? [그림
4
-
5
]는
17
개 엔
트리가 있는 최대 힙에서 각 엔트리의 우선순위만을 보여준다. 보다시피 레벨
0
에는 최대 힙의
모든 엔트리 중에서 우선순위가 가장 높은 단일 엔트리가 있다.
x
y
방향의 화살표가 있으
면 엔트리
x
는 엔트리
y
보다 우선순위가 높다.
그림
4-5
최대 이진 힙 예
이런 엔트리는 정렬된 리스트에서처럼 완전히 정렬된 것이 아니기에 우선순위가 가장 낮은 엔
트리를 찾으려면 잠시 탐색을 해봐야 한다(힌트: 해당 엔트리는 레벨
3
에 있다). 하지만 결과
로 나온 구조는 훌륭한 속성을 가진다. 레벨
1
에는 두 개의 엔트리가 있으며, 그 중 하나는 우
선순위가 두 번째로 높아야 한다(혹은 가장 높은 우선순위와 동일하다 ). 각 레벨
k
(마지막은
제외 )는 엔트리로 가득 차 있고
2
k
개의 엔트리를 포함한다. 맨 밑 레벨에만 일부가 채워져 있
으며 (
16
개가 가능한데
2
개만 있다 ) 왼쪽에서 오른쪽으로 채워진다. 또한 힙에는 우선순위가
같은 엔트리가 있을 수 있다. 우선순위
8
14
가 여러 번 보인다.
각 엔트리에서 화살표가
2
개보다 많이 나오지 않도록 해
최대 이진 힙
max
binary
heap
을 구성한다.
우선순위가
15
인 레벨
0
의 엔트리를 ...
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