当前位置:网站首页>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);
}
}

边栏推荐
- 2022拼多多详情/拼多多商品详情/拼多多sku详情
- 如何提升数据质量
- [QT] qtcreator uninstall and installation (abnormal state)
- Operate database transactions with jpatractionmanager
- The origin of usb-if Association and various interfaces
- 【CMake】Qt creator 里面的 cmake 配置
- Heketi record
- 下载在线视频 m3u8使用教程
- The difference between timer and scheduledthreadpoolexecutor
- 【QT】QtCreator卸载与安装(非正常状态)
猜你喜欢

毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?

Windows installation WSL (II)
Linux centos7 installation Oracle11g super perfect novice tutorial

Kuberntes cloud native combat high availability deployment architecture

Selectively inhibiting learning bias for active sampling

LDR6035智能蓝牙音响可充可放(5.9.12.15.20V)快充快放设备充电

Correlation - intra group correlation coefficient

The new version of graphic network PDF will be released soon

数据分析方法论与前人经验总结【笔记干货】

使用多线程Callable查询oracle数据库
随机推荐
js 公共库 cdn 推荐
mysql之B tree 以及 B+tree
【opencv】train&test HOG+SVM
Linux centos7 installation Oracle11g super perfect novice tutorial
What does open loop and closed loop mean?
Three methods of finding inverse numbers
Download the online video m3u8 tutorial
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
UVM tutorial
2022拼多多详情/拼多多商品详情/拼多多sku详情
Which securities company is safer to open a stock account
Windows installation WSL (II)
Windows10 install WSL (I) (wslregisterdistribution error)
B tree and b+tree of MySQL
【CTF】bjdctf_2020_babystack2
Difficult to get up syndrome (bit by bit greed)
PHP reads ini or env type configuration
2022 pinduoduo details / pinduoduo product details / pinduoduo SKU details
Kuberntes cloud native combat high availability deployment architecture
RPA tutorial 01: Excel automation from introduction to practice
