Skip to content

Commit

Permalink
add pic, update cheatsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Feb 24, 2024
1 parent 356cf62 commit cbc023e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/cheatsheet/tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ https://www.facebook.com/photo?fbid=787938986701653&set=a.620391230123097# Tree
- height
- distance from any node to lowest node (start from 0 or 1 is OK)
- via Post-order traverse (後序遍歷)
- 後序遍歷求 高度 (`子節點 到 bottom 距離`)
- 後序遍歷求 高度 (`子節點 到 bottom 距離`) (`node -> bottom`)
- depth
- distance from any node to root (start from 0 or 1 is OK)
- via Pre-order traverse (前序遍歷)
- LC 104
- 前序遍歷求 深度 (`root 到 子節點 距離`)
- 前序遍歷求 深度 (`root 到 子節點 距離`) (`root -> node`)
- [tree : height vs depth](https://stackoverflow.com/questions/2603692/what-is-the-difference-between-depth-and-height-in-a-tree)

- <img src ="https://github.com/yennanliu/CS_basics/blob/master/doc/pic/tree_depth_vs_height.jpeg" ></p>

- Ordering (pre-order or in-order ..)
- If there is NO "root op logic" (e.g. 沒有中節點處理邏輯)
-> then it can be any order
Expand Down
Binary file added doc/pic/tree_depth_vs_height.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cbc023e

Please sign in to comment.