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

边栏推荐
- 关联性——组内相关系数
- JS common library CDN recommendation
- 一个实习生的CnosDB之旅
- Leetcode 96 différents arbres de recherche binaires
- Is it safe and reliable to open an account in Caixue school and make new debts?
- UVM tutorial
- Which app is better and more secure for stock mobile account opening
- ERP项目施行计划的目的是什么?
- [QT] test whether QT can connect to the database
- SQL数据分析之窗口排序函数rank、dense_rank、raw_number与lag、lead窗口偏移函数【用法整理】
猜你喜欢

The new version of graphic network PDF will be released soon

Guide d'installation du serveur SQL

Leetcode 96 différents arbres de recherche binaires

B tree and b+tree of MySQL

Heketi record

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

The origin of usb-if Association and various interfaces
Linux centos7 installation Oracle11g super perfect novice tutorial

Talents come from afar, and Wangcheng district has consolidated the intellectual base of "strengthening the provincial capital"

Review data desensitization system
随机推荐
数据库--SqlServer详解
Talents come from afar, and Wangcheng district has consolidated the intellectual base of "strengthening the provincial capital"
From 20s to 500ms, I used these three methods
What is ThreadLocal memory leak and how to solve it
Asp .NetCore 微信订阅号自动回复之文本篇
Is it safe to buy funds in a securities account? Where can I buy funds
Jielizhi, production line assembly link [chapter]
求逆序数的三个方法
【QT】测试Qt是否能连接上数据库
Kuberntes cloud native combat high availability deployment architecture
Iota in golang
Correlation - intra group correlation coefficient
Node -- egg implements the interface of uploading files
Halcon knowledge: an attempt of 3D reconstruction
LeetCode 0241. Design priority for arithmetic expressions - DFS
Vue force cleaning browser cache
Openvino model performance evaluation tool DL workbench
[QT] qtcreator uninstall and installation (abnormal state)
Operate database transactions with jpatractionmanager
Cmake engineering related
