- 博客(10)
- 收藏
- 关注
原创 Sum Root to Leaf Numbers 求路径之和
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota
2014-04-25 20:42:26 573
原创 Binary Trees 斯坦福教育库
Binary Treesby Nick ParlanteThis article introduces the basic concepts of binary trees, and then works through a series of practice problems with solution code in C/C++ and Java. Binary trees
2014-04-18 20:39:28 1115
原创 Minimum Depth of Binary Tree 二叉树最小深度
///** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { pub
2014-04-17 22:46:04 669
转载 后序遍历 Binary Tree Postorder Traversal -- LeetCode
二叉树的后序遍历我们还是介绍三种方法,第一种是递归,第二种是迭代方法,第三种是用线索二叉树。 递归还是那么简单,算法的时间复杂度是O(n), 而空间复杂度则是递归栈的大小,即O(logn)。代码如下:public ArrayListInteger> postorderTraversal(TreeNode root) { ArrayListInteger> res = new ArrayLi
2014-04-15 17:49:19 677
转载 两种创建String对象的区别
创建String对象,我们可以用两种方式: 1, String s = new String("Victory");2, String s = "Victory";那么这两种方式的区别是?先看一个程序:String s1,s2; s1=new String("we are students"); s2=new
2014-04-14 17:14:27 690
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人