고 기대합니다. 트리가 가득 차 있거나 부분적으로 가득 찼을 때도 그렇습니다. 하지만 앞으로
볼 것처럼 항상 그러한 것은 아닙니다.
log
n
에 비례하는 시간이 걸리는 알고리즘을 로그 시간
logarithmic
또는
log
time
이라고 합니다. 증가
차수는
O
(
log
n
)에 해당합니다.
12.3
실습
10
이번 실습에서는 이진 탐색 트리로
Map
인터페이스를 구현합니다. 다음은
MyTreeMap
클래스
구현의 시작 부분입니다
(파일명:
MyTreeMap.java
)
.
public class MyTreeMap
<
K
,
V
>
implements Map
<
K
,
V
>
{
private int size
=
0
;
private Node root
=
null
;
인스턴스 변수인
size
는 키의 개수를 추적하고
root
는 트리의 루트 노드를 참조합니다. 트리
가 비면
root
는
null
이 되고
size
는
0
이 됩니다.
MyTreeMap
클래스 내부에 정의된
Node
클래스는 ...
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.
O’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
I 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
I’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
I'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.