스크린샷 2024-12-16 오전 2.21.18.png

Tree = root node가 있음.

root = parent가 없음.

leaf nodes = child가 없음

root = level 0

Binary tree

각 노드가 successor node(children)을 2개까지만 가질 수 있음( 없거나 한개일 수 있음 )

스크린샷 2024-12-16 오전 2.22.40.png

B와 C는 parent공유하고 있으니 sibling관계

parent보다 위는 ancestor

child보다 아래도 descendant

unary tree = list와 같음

루트로부터 특정 노드로 가는 path가 딱 하나 존재해야 tree이다.

height = number of levels

level 0~3이면 height=4

ancestor = 특정 노드에서 루트까지 가는 path에 존재하는 노드들

full tree

스크린샷 2024-12-16 오전 2.27.38.png

full binary tree의 노드수 2^height-1

시간복잡도는 logN