Skip to content

Instantly share code, notes, and snippets.

@chairco
Created January 17, 2019 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chairco/91cc83d32bd91a965aa606d1718ee670 to your computer and use it in GitHub Desktop.
Save chairco/91cc83d32bd91a965aa606d1718ee670 to your computer and use it in GitHub Desktop.
DS tree

關於 Tree 有兩種搜尋策略來瀏覽

  1. Breath First Search(BFS) 按照高度由上到下逐層掃描,較高的樹會比較低的樹優先被訪問。

  2. Depth First Search(DFS) 以深度為優先,以便從一個根開始一直達到某個葉子然後回到 root 到達令一個分支,這種方式可以分為 preorder, inorderpostorder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment