Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ascoders/weekly
Browse files Browse the repository at this point in the history
  • Loading branch information
ascoders committed Jul 19, 2021
2 parents 9b9d02b + ec65f68 commit 13963fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 算法/201.精读《算法 - 二叉树》.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ function visitTree(node: TreeNode) {

最后只要递归一下就能解题了,我们将输入不断拆解为左右子树的的输入,直到达到终止条件。

解决此题的关键是,不仅要直到如何写前中后序遍历,还要知道前序遍历第一个节点是根节点,后序遍历最后一个节点是根节点,中序遍历以根节点为中心,左右分别是其左右子树,这几个重要延伸特征。
解决此题的关键是,不仅要知道如何写前中后序遍历,还要知道前序遍历第一个节点是根节点,后序遍历最后一个节点是根节点,中序遍历以根节点为中心,左右分别是其左右子树,这几个重要延伸特征。

说完了反向,我们说正向,即递归一颗二叉树
说完了反向,我们说正向,即递归一棵二叉树

其实二叉树除了递归,还有一种常见的遍历方法是利用栈进行广度优先遍历,典型题目有从上到下打印二叉树。

Expand Down

0 comments on commit 13963fb

Please sign in to comment.