[leetcode]145-二叉树的后序遍历

马谦马谦马谦 2020年2月9日14:01:20
评论
353字阅读1分10秒

来源:力扣(LeetCode)

链接:https://leetcode-cn.com/problems/binary-tree-postorder-traversal

著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。

一、题目描述

给定一个二叉树,返回它的 后序 遍历。

例如输入[1,null,2,3] :

输出:

进阶: 递归算法很简单,你可以通过迭代算法完成吗?

二、题解

参考:二叉树的后序遍历

三、代码

3.1 通过栈+链表实现

[leetcode]145-二叉树的后序遍历

3.2 通过2次压栈实现

马谦马谦马谦
  • 本文由 发表于 2020年2月9日14:01:20
  • 转载请务必保留本文链接:https://www.dyxmq.cn/program/algorithms/leetcode145-binary-tree-postorder-traversal.html
[leetcode]125-验证回文串 数据结构和算法

[leetcode]125-验证回文串

这道题本身是非常简单的,但是由于审题不仔细,忽略一个细节,导致提交了6次才成功,要检讨! 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/val...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: