Related to: Data Structure

Binary Tree

Child Node가 최대 두 개인 node들로 구성된 Tree

정이진트리(full binary tree), 완전이진트리(complete binary tree), 균형이진트리(balanced binary tree) 등이 있음

Full Binary Tree

모든 레벨에서 노드들이 꽉 채워진(=잎새노드를 제외한 모든 노드가 자식노드를 2개 가짐) 이진트리

Untitled 55.png

Complete Binary Tree

마지막 레벨을 제외한 모든 레벨에서 노드들이 꽉 채워진 이진트리

Untitled 1 42.png

Balanced Binary Tree

모든 잎새노드의 깊이 차이가 많아야 1인 트리, 균형이진트리는 예측 가능한 깊이(predictable depth)를 가지며, 노드가 n개인 균형이진트리의 깊이는 log(n)을 내림한 값이 됨

Untitled 2 28.png

참조

https://ratsgo.github.io/data structure&algorithm/2017/10/21/tree/