1. 程式人生 > >演算法總結-二叉樹的深度優先搜尋

演算法總結-二叉樹的深度優先搜尋

這裡寫圖片描述

1 遍歷的問題

二叉樹的前序遍歷
http://www.lintcode.com/zh-cn/problem/binary-tree-preorder-traversal/

二叉樹的中序遍歷
http://www.lintcode.com/zh-cn/problem/binary-tree-inorder-traversal/

二叉樹的後序遍歷
http://www.lintcode.com/zh-cn/problem/binary-tree-postorder-traversal/

分治法

這裡寫圖片描述

二叉樹的最大深度
http://www.lintcode.com/zh-cn/problem/maximum-depth-of-binary-tree/

二叉樹的所有路徑
http://www.lintcode.com/zh-cn/problem/binary-tree-paths/

最小子樹
http://www.jiuzhang.com/solutions/minimum-subtree/

平衡二叉樹
http://www.lintcode.com/zh-cn/problem/balanced-binary-tree/

具有最大平均數的子樹
http://www.jiuzhang.com/solutions/subtree-with-maximum-average/

最近公共祖先
http://www.lintcode.com/zh-cn/problem/lowest-common-ancestor/

驗證二叉查詢樹
http://www.lintcode.com/zh-cn/problem/validate-binary-search-tree/

將二叉查詢樹轉換成雙鏈表
http://www.lintcode.com/zh-cn/problem/convert-binary-search-tree-to-doubly-linked-list/

將二叉樹拆成連結串列
http://www.lintcode.com/zh-cn/problem/flatten-binary-tree-to-linked-list/

更多題目
http://www.jiuzhang.com/qa/983/