Tree / Graph
✅ Tree
node ➕ edges
- a tree cannot have cycles(if there is cycle, then it is a graph)
- one unique way from root to a certain node
- if count of node is
n
, number of edges will ben-1
- 👍🏻 easy to navigate and search data
☑️ Binary Tree
tree with maximum of two children node
- complete binary trees ➡️ heap
- balanced binary trees
- degenerate, pathological binary trees
- 👎🏻 if tree is not balanced, efficieny ⬇️
☑️ Ternary Tree
tree with atmost three child nodes
- left, mid, right nodes
🆚 Graph
Graph: 👍🏻 길찾기 문제
Tree:
- 그래프의 일종
- no cycle ❌
- has direction
- 👍🏻 데이터 찾기
- if not root node, all node has parent node
- maximum two child node
💡 Reference
This post is licensed under CC BY 4.0 by the author.