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

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

by 조지 하이네만, 윤대석
May 2022
Beginner to intermediate
296 pages
5h 54m
Korean
Hanbit Media, Inc.
Content preview from 똑똑한 코드 작성을 위한 실전 알고리즘
189
6
이진 트리
6.2
이진 탐색 트리
이진 트리는 모든 재귀적 자료구조의 대부다.
이진 탐색 트리
binary
search
tree
는 효율적인 탐색, 삽
입 및 삭제 연산을 가지는 값의 컬렉션을 저장할 수 있다.
이진 배열 탐색의 성능이
O
(
log
N
)이 되려면 값을 정렬된 배열에 저장해야 한다. 사용자가
정보를 더 쉽게 볼 수 있도록 정보를 정렬된 순서로 생성하는 데는 무수히 많은 이유가 있다.
실용적인 관점으로 보면, 매우 큰 고정 배열은 기반 운영체제에서 할당되는 연속적인 메모리
를 필요로 하므로 운영하기가 쉽지 않다. 게다가 배열의 크기를 변경하면 다음과 같은 문제가
있다.
배열에 값을 추가하기 위해 더 큰 배열이 새로 생성되고, 이전 배열에 있던 값들은 (새 값을 위한 공간을
추가한) 새로 생성한 배열로 복사된다. 마지막으로 이전 배열을 위한 메모리가 해제된다.
배열에서 값을 제거하기 위해, 제거된 값의 오른쪽에 있는 모든 값이 왼쪽으로 하나의 인덱스만큼 이동
해야 한다. 코드는 배열의 끝에 ‘사용하지 않는’ 인덱스 위치가 있음을 기억해야 한다.
파이썬 프로그램은 프로그래머가 따로 처리하지 않아도 내장
list
자료형이 증가하고 축소할
수 있어 이런 어려움을 피할 수 있지만, 최악의 경우에 파이썬
list
에 값을 추가하는 성능은
O
(
N
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