码迷,mamicode.com
首页 >  
搜索关键字:二叉树.binary tree    ( 18099个结果
Problem Binary Tree Preorder Traversal
Problem Description:Given a binary tree, return thepreordertraversal of its nodes' values.Solution: 1 public List preorderTraversal(TreeNode root)...
分类:其他好文   时间:2014-07-07 16:34:34    阅读次数:208
[Leetcode][Tree][Same Tree]
非常简单的一道题/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x...
分类:其他好文   时间:2014-07-07 16:25:49    阅读次数:220
Problem Sum Root to Leaf Numbers
Problem Description:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf ...
分类:其他好文   时间:2014-07-07 16:01:34    阅读次数:223
Problem Binary Tree Maximum Path Sum
Problem Description:Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below bina...
分类:其他好文   时间:2014-07-07 15:57:05    阅读次数:252
Problem Populating Next Right Pointers in Each Node II
Problem Description:Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your pr...
分类:其他好文   时间:2014-07-07 15:46:01    阅读次数:267
Problem Populating Next Right Pointers in Each Node
Problem Description:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Popul...
分类:其他好文   时间:2014-07-07 15:45:18    阅读次数:166
leveldb源码分析--Comparator
既然leveldb是一个按Key序组织的LSM-Tree实现,那么对于Key的比较就是非常之重要了,这个Key的比较在leveldb中是Comparator的形式出现的。我们首先来看看Comparator的基本方法有哪些 // 实际的比较函数 virtual int Compare(const Sl...
分类:数据库   时间:2014-07-07 15:40:12    阅读次数:862
[Leetcode][Tree][Depth of Binary Tree]
计算树的深度1、minimum depth of binary tree 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * ...
分类:其他好文   时间:2014-07-07 15:31:40    阅读次数:182
leecode 树的平衡判定 java
以前写过c++版本的,感觉java写的好舒心啊/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * Tree...
分类:编程语言   时间:2014-07-07 15:27:55    阅读次数:196
[Leetcode][Tree][Construct Binary Tree from Preorder/Postorder and Inorder Traversal ]
从树的中序遍历+前/后序遍历重建一棵树。必须使用iterator才能过,否则会MLE。1、preorder + inorder第一个版本,使用坐标范围: 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int...
分类:其他好文   时间:2014-07-07 14:11:10    阅读次数:147
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!