mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
@ -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/)
|
||||
|
||||
为什么可以用迭代法(非递归的方式)来实现二叉树的前后中序遍历呢?
|
||||
|
||||
|
@ -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/)
|
||||
|
||||
可能有同学感觉前后中序遍历的递归太简单了,要打迭代法(非递归),别急,我们明天打迭代法,打个通透!
|
||||
|
||||
|
Reference in New Issue
Block a user