226. 翻转二叉树 - 简单

226. 翻转二叉树
迭代解法
- 时间复杂度
O(n) n 为节点个数,每个节点访问一次 - 空间复杂度
O(n)
1 | // 从根节点开始反转的 |
递归解法
- 时间复杂度
O(n) n 为节点个数,每个节点访问一次 - 空间复杂度
O(n)
1 | // 从叶子节点开始反转的 |
- Post title:226. 翻转二叉树 - 简单
- Post author:xxxixxxx
- Create time:2021-02-24 15:47:00
- Post link:https://xxxixxx.github.io/2021/02/24/2000-017-226. 翻转二叉树/
- Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.
Comments