1 int depth = 0; 2 int currentMaxDepth = 0; 3 public int maxDepth(TreeNode root) { 4 if(root == null){ 5 return 0; 6 } 7 8 int leftDepth = 1; 9 int ri... ...
分类:
其他好文 时间:
2019-12-08 12:15:18
阅读次数:
84
异常原因: 磁盘空间不足 解决办法: 1. 新增磁盘 2. 删除无用数据 信息补充: df: df -h #查询磁盘空间命令 du: du|sort -nr|more #显示目录或者文件所占空间 du -sh #统计当前目录的大小 du -h --max-depth=1 | grep 'G' |so ...
分类:
其他好文 时间:
2019-12-06 11:30:15
阅读次数:
336
package util import ( "strings" ) type Node struct { //rune表示一个utf8字符 char rune Data interface{} parent *Node Depth int //childs 用来当前节点的所有孩子节点 childs ... ...
分类:
其他好文 时间:
2019-12-03 23:06:42
阅读次数:
107
如何查看windows某个目录下所有文件/文件夹的大小? https://www.cnblogs.com/gered/p/10208281.html 挺好的工具 linux 上面 我就是使用 du -ah --max-depth=1 来查看了 windows 有这么一个好用的工具也挺好呢. 如何查看 ...
per-tools 是性能优化大师brendan gregg 就有perf 以及ftrace 编写的性能优化工具集 提供了io 、网络、系统调用。。。大部分方面的性能分析工具。 一张参考图 安装 clone 代码 git clone --depth 1 https://github.com/bren ...
分类:
其他好文 时间:
2019-12-01 13:32:19
阅读次数:
189
该系列题目取自 LeetCode 精选 TOP 面试题列表:https://leetcode cn.com/problemset/top/ 题目描述 原题链接:https://leetcode cn.com/problems/maximum depth of binary tree 给定一个二叉树, ...
分类:
其他好文 时间:
2019-12-01 11:41:20
阅读次数:
81
6-7 求二叉树的深度 (6 分) 本题要求实现一个函数,可返回二叉树的深度。 函数接口定义: int Depth(BiTree T); T是二叉树树根指针,函数Depth返回二叉树的深度,若树为空,返回0。 裁判测试程序样例: #include <stdio.h> #include <stdlib ...
分类:
其他好文 时间:
2019-11-25 20:10:30
阅读次数:
733
似懂非懂。。 class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: self.ans=1 def depth(node): if not node: return 0 L=depth(node.left) R=d ...
分类:
其他好文 时间:
2019-11-22 23:33:47
阅读次数:
75
1.图的两种遍历方式 图的遍历通常有两种方式,即深度优先搜索(Depth First Search)和广度优先搜索(Breadth First Search)。前者类似于树的先序遍历,而后者类似于树的层次遍历。 2.深搜的实现 ...
分类:
其他好文 时间:
2019-11-12 01:09:01
阅读次数:
69
dfs(Depth_First_Search): 它是一种图的遍历形式,其具体意义是从图中的某个顶点v出发,不停的遍历v的各个临界点,然后从各个临界点开始继续的向四周发散,直至遍历完所有与v路径相通的点,究其本质其实是应用了一种递归的思想; 模板代码为: void dfs()//参数用来表示状态 { ...
分类:
其他好文 时间:
2019-11-09 19:49:47
阅读次数:
87