Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2015-06-10 06:33:56
阅读次数:
99
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他好文 时间:
2015-06-10 06:32:56
阅读次数:
115
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:
其他好文 时间:
2015-06-10 06:32:31
阅读次数:
106
跟之前的解法一模一样Binary Tree Level Order Traversal I,II 不赘述public class Solution { public ArrayList> zigzagLevelOrder(TreeNode root) { ArrayList> r...
分类:
其他好文 时间:
2015-06-10 06:31:24
阅读次数:
94
Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n...
分类:
其他好文 时间:
2015-06-10 06:27:16
阅读次数:
102
平衡二叉树(Self-Balancing Binary Search Tree/Height-Balanced Binary Search Tree),是一种二叉排序树,其中每一个节点的左子树和右子树的高度差至多等于1.平衡二叉树的前提是二叉排序树,不是二叉排序树的都不是平衡二叉树。
平衡因子BF(Balance Factor):二叉树上节点的左子树深度减去右子树深度的值。最小不平衡子树:距离插入...
分类:
其他好文 时间:
2015-06-09 23:48:22
阅读次数:
414
今天做了一道leetcode题,刚开始是暴力破解,发现special judge, very large tree 过不去,然后一顿想,一顿查,发现可以运用complete binary tree 的性质,然后用的python编写,发现还是过不去,(这个版本是运用左右子数的高度去查找,如果相等那么可...
分类:
其他好文 时间:
2015-06-09 21:45:50
阅读次数:
113
题目链接 题目要求: Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given ...
分类:
其他好文 时间:
2015-06-09 21:20:57
阅读次数:
76
二叉排序树(Binary Sort Tree),又称二叉查找树。它或者是一颗空树,或者是具有下列性质的二叉树。
若它的左子树不空,则左子树上所有节点的值都小于它的根节点的值;
若它的右子树不空,则右子树上所有节点的值都大于它的根节点的值;
它的左、右子树也分别为二叉排序树。
上面就是一棵二叉排序树,当我们对它进行中序遍历时,就可以得到一个有序的序列{35,37,47,51,58,62,73,88...
分类:
编程语言 时间:
2015-06-09 20:08:34
阅读次数:
266
需要检查一下这个文件是否 shell 脚本, 如果是shell脚本, 才可以使用 “sh ***.run”的形式执行。
如果本身是一个可执行的命令程序, 不需要使用 sh, 直接加上执行权限, 执行这个应用程序就可以 (类似 windows下的 。exe文件 )
如果不是shell脚本
1. file 文件名
可以查看文件类型;
2. 或者: more 文件名
查看文件内容是否可读文...
分类:
系统相关 时间:
2015-06-09 17:32:25
阅读次数:
677