Merge pull request #1258 from 404-error-404/master

修改 给二叉树遍历题目加上力扣链接
This commit is contained in:
程序员Carl
2022-05-15 14:33:36 +08:00
committed by GitHub
2 changed files with 6 additions and 6 deletions

View File

@ -11,9 +11,9 @@
看完本篇大家可以使用迭代法再重新解决如下三道leetcode上的题目
* 144.二叉树的前序遍历
* 94.二叉树的中序遍历
* 145.二叉树的后序遍历
* [144.二叉树的前序遍历](https://leetcode-cn.com/problems/binary-tree-preorder-traversal/)
* [94.二叉树的中序遍历](https://leetcode-cn.com/problems/binary-tree-inorder-traversal/)
* [145.二叉树的后序遍历](https://leetcode-cn.com/problems/binary-tree-postorder-traversal/)
为什么可以用迭代法(非递归的方式)来实现二叉树的前后中序遍历呢?

View File

@ -99,9 +99,9 @@ void traversal(TreeNode* cur, vector<int>& vec) {
此时大家可以做一做leetcode上三道题目分别是
* 144.二叉树的前序遍历
* 145.二叉树的后序遍历
* 94.二叉树的中序遍历
* [144.二叉树的前序遍历](https://leetcode-cn.com/problems/binary-tree-preorder-traversal/)
* [145.二叉树的后序遍历](https://leetcode-cn.com/problems/binary-tree-postorder-traversal/)
* [94.二叉树的中序遍历](https://leetcode-cn.com/problems/binary-tree-inorder-traversal/)
可能有同学感觉前后中序遍历的递归太简单了,要打迭代法(非递归),别急,我们明天打迭代法,打个通透!