ECE244H1 Chapter Notes - Chapter 19: Binary Tree, Adjacency Matrix
DepartmentElectrical and Computer Engineering
This preview shows half of the first page. to view the full 2 pages of the document.
What’s the difference between binary tree and graph?
- Binary tree has root and graphs don’t
- Binary tree has at most two children and root can be in cycle (n children)
- Graphs may have non-connected subtree and binary tree don’t
Graph Traversal Order:
- Visit children before siblings (depth first traversal)
- Visit siblings before children (breadth first traversal)
- Visit adjacent nodes with smaller weights before ones with larger weights (best first
Depth First Traversal → visit children before siblings
Breadth First Traversal → visit siblings before children
Which node should be the starting node?
- Usually the smallest node unless specify
What are “visit flag” use for in graphs?
You're Reading a Preview
Unlock to view full version