![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树
29DCH
In me the tiger sniffs the rose.
展开
-
leetcode144 Binary Tree Preorder Traversal(二叉树的前序遍历)
题目链接 https://leetcode.com/problems/binary-tree-preorder-traversal/ 知识点: 树,递归,栈,迭代等。 思路: 1.递归进行树的前序遍历 2.借助栈来进行迭代 AC代码: 1. 递归 class Solution { public: vector<int> res; vector<int&a原创 2018-11-14 21:57:09 · 129 阅读 · 0 评论 -
leetcode102 Binary Tree Level Order Traversal(二叉树的层次遍历)
题目链接:https://leetcode.com/problems/binary-tree-level-order-traversal/ 知识点: 树,队列 思路: 借助队列进行树的层序遍历,队列存储pair<TreeNode*,int>,节点和层数,便于一层一层地进行存储! AC代码: class Solution { public: vector<vector&lt...原创 2018-11-20 21:51:50 · 109 阅读 · 0 评论