二叉树,天然的递归结构。递归算法中,需要注意:递归终止条件、递归过程。

复习二叉树相关的所有操作

二分搜索树中的问题

二分搜索树中的基本操作

img

面试实战

  • Invert Binary Tree(#226)

  • Path Sum(#112)

  • Binary Tree Paths(#257)

  • Path Sum III(#437)

  • Lowest Common Ancestor of a Binary Search Tree(#235)

程序

具体实现:

见代码。