L3:06 - Binary Tree DFS Template
来源:互联网 发布:淘宝号查号网站 编辑:程序博客网 时间:2024/06/04 20:08
Binary Tree DFS template
/** * Copyright: NineChapter * - Algorithm Course, Mock Interview, Interview Questions * - More details on: http://www.ninechapter.com/ */Template 1: Traversepublic class Solution { public void traverse(TreeNode root) { if (root == null) { return; } // do something with root traverse(root.left); // do something with root traverse(root.right); // do something with root }}Tempate 2: Divide & Conquerpublic class Solution { public ResultType traversal(TreeNode root) { // null or leaf if (root == null) { // do something and return; } // Divide ResultType left = traversal(root.left); ResultType right = traversal(root.right); // Conquer ResultType result = Merge from left and right. return result; }}
0 0
- L3:06 - Binary Tree DFS Template
- Binary Tree DFS Template
- L3:01 - Binary Tree DFS Traversal
- L3:04 - Balanced Binary Tree
- binary tree template-c++
- Binary Indexed Tree Template
- Binary Tree BFS Template
- L3:03 - Maximum Depth of Binary Tree
- L3:05 - Binary Tree Maximum Path Sum
- L3:07 - Binary Tree BFS Traversal
- L3:08 - Binary Tree Level Order Traversal
- Java Binary Tree DFS
- Binary Tree DFS遍历专题
- DFS Validate Binary Search Tree
- DFS:257. Binary Tree Paths
- DFS:110. Balanced Binary Tree
- [leetcode][tree][dfs] Balanced Binary Tree
- [LeetCode] Minimum Depth of Binary Tree - DFS
- L3:05 - Binary Tree Maximum Path Sum
- 三极管的电平转换及驱动电路分析
- js 图片走马灯
- Linux学习记录(四)
- 对功率谱的一点理解
- L3:06 - Binary Tree DFS Template
- 数组的指针特性
- L3:07 - Binary Tree BFS Traversal
- L3:08 - Binary Tree Level Order Traversal
- DSP-BIOS使用入门
- 使用Tcl脚本分配FPGA管脚
- Markdown中插入数学公式的方法
- margin
- Mysql终极数据库隔离级别讲解