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

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

by 조지 하이네만, 윤대석
May 2022
Beginner to intermediate
296 pages
5h 54m
Korean
Hanbit Media, Inc.
Content preview from 똑똑한 코드 작성을 위한 실전 알고리즘
169
5
정렬
5.7
퀵 정렬
병합 정렬 외에 분할 정복을 따르는 정렬 알고리즘으로
퀵 정렬
Quicksort
7
이 있다. 퀵 정렬은 지금
까지 설계된 알고리즘 중 가장 효율적이고 많이 연구되었다.
A
에서
피벗
pivot
p
로 사용할 요
소를 선택해 재귀적으로 정렬한 다음
p
를 정렬된 최종 배열 내 적절한 위치에 삽입한다. 이를
수행하기 위해
A
[
lo
..
hi
]
의 내용을
p
값을 기준으로 재배열한다 (
p
보다 작으면 왼쪽 하위
배열로,
p
보다 크면 오른쪽 하위 배열로). [그림
5
-
11
]을 보면 분할된 배열은 이러한 기준으
로 배열되어 있다.
그림
5-11
A
[
0
]
을 피벗으로 사용해
partition
(
A
,
0
,
7
,
0
)
을 호출한 결과
전체 배열의 정렬 결과를 알지 못한 채,
p
가 최종 정렬된 배열에서 어디에 위치할지 어떻
게 알까? 분할
partitioning
A
의 모든 요소를 정렬하지 않고
p
를 기반으로 일부만 재정렬한다.
partition
()
의 구현은
1
장 연습 문제를 참조하자. [그림
5
-
11
]에서
partition
()
이 완료된
후, 정렬할 왼쪽 하위 배열은 값이
2
개인 반면 오른쪽 하위 배열은
5
개다. 각 하위 배열은 퀵
정렬을 통해 재귀적으로 정렬된다 (코드
5
-
8
).
7
퀵 정렬은
1959
년에 토니 호어
Tony
Hoare
가 고안한 것으로, ...
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