当前位置:网站首页>Leetcode skimming: binary tree 02 (middle order traversal of binary tree)
Leetcode skimming: binary tree 02 (middle order traversal of binary tree)
2022-07-02 00:26:00 【Taotao can't learn English】
94. Middle order traversal of binary trees
package com.programmercarl.tree;
import java.util.ArrayList;
import java.util.List;
/** * @ClassName InorderTraversal * @Descriotion TODO * @Author nitaotao * @Date 2022/7/1 15:32 * @Version 1.0 * https://leetcode.cn/problems/binary-tree-inorder-traversal/ * 94. Middle order traversal of binary trees **/
public class InorderTraversal {
public List<Integer> inorderTraversal(TreeNode root) {
List<Integer> result = new ArrayList<Integer>();
traversal(root, result);
return result;
}
/** * In the sequence traversal * @param root * @param result */
public void traversal(TreeNode root, List<Integer> result) {
if(root==null) {
return;
}
// Left middle right
traversal(root.left, result);
result.add(root.val);
traversal(root.right, result);
}
}

边栏推荐
- ERP项目施行计划的目的是什么?
- Selectively inhibiting learning bias for active sampling
- vue 强制清理浏览器缓存
- Node——Egg 实现上传文件接口
- 2022 pinduoduo details / pinduoduo product details / pinduoduo SKU details
- Niuke - Practice 101 - reasoning clown
- Windows installation WSL (II)
- 数据分析方法论与前人经验总结【笔记干货】
- 【QT】QtCreator卸载与安装(非正常状态)
- js 公共库 cdn 推荐
猜你喜欢

Material design component - use bottomsheet to show extended content (I)

export default 导出的对象,不能解构问题,和module.exports的区别

Using multithreaded callable to query Oracle Database

Dongge cashes in and the boss retires?

What is ThreadLocal memory leak and how to solve it
![Jielizhi, production line assembly link [chapter]](/img/f8/20c41ffe9468d59bf25ea49f73751e.png)
Jielizhi, production line assembly link [chapter]
![[cmake] cmake configuration in QT Creator](/img/e3/1cf76f88eaddb5d32184523dfb049c.png)
[cmake] cmake configuration in QT Creator

Relatively easy to understand PID understanding

Ldr6035 smart Bluetooth audio can continuously charge and discharge mobile devices

Shell process control
随机推荐
Selectively inhibiting learning bias for active sampling
LDR6035智能蓝牙音响可充可放(5.9.12.15.20V)快充快放设备充电
Linux CentOS7安装Oracle11g的超完美新手教程
实例讲解将Graph Explorer搬上JupyterLab
Review data desensitization system
Windows10 install WSL (I) (wslregisterdistribution error)
Node——Egg 创建本地文件访问接口
It's nothing to be utilitarian!
GCC compilation
Is it safe to choose mobile phone for stock trading account opening in Beijing?
Key points of security agreement
[QT] qtcreator uninstall and installation (abnormal state)
Digital transformation has a long way to go, so how to take the key first step
Vue force cleaning browser cache
SQL Server Installation Guide
[QT] solve the problem that QT MSVC 2017 cannot compile
cookie、session、tooken
Shell custom function
Jielizhi Bluetooth headset quality control and production skills [chapter]
ERP项目施行计划的目的是什么?
