码迷,mamicode.com
首页 >  
搜索关键字:leaf    ( 924个结果
Binary Tree Level Order Traversal II
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For e...
分类:其他好文   时间:2014-08-17 15:31:52    阅读次数:221
Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum ...
分类:其他好文   时间:2014-08-16 22:24:21    阅读次数:212
Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:其他好文   时间:2014-08-16 22:21:41    阅读次数:235
[leetcode]Sum Root to Leaf Numbers
Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l...
分类:其他好文   时间:2014-08-16 00:59:09    阅读次数:197
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...
分类:其他好文   时间:2014-08-13 18:17:26    阅读次数:208
Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:其他好文   时间:2014-08-13 14:39:26    阅读次数:153
uva 548 - Tree
TreeYou are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the bi....
分类:其他好文   时间:2014-08-10 18:11:20    阅读次数:273
哈弗曼编码解码
#lang scheme ( define l ( list 1 2 3 4 ) ) ( define l1 ( list 5 6 7 8 ) ) ( define nil '() ) ( define ( make-leaf symbol weight )    ( list 'leaf symbol weight ) )   ( define ( l...
分类:其他好文   时间:2014-08-09 02:39:06    阅读次数:236
Sum Root to Leaf Numbers
该题可以用DFS解决,在DFS时记录path,当到达leaf时将path所表示的数加到sum上。 1 class Solution { 2 public: 3 int sumNumbers(TreeNode *root) { 4 vector path; 5 ...
分类:其他好文   时间:2014-08-07 18:50:40    阅读次数:197
Sum Root to Leaf Numbers
问题:根节点到叶子结点的所有权值和分析:从根节点遍历,若遍历到叶子结点,则sum+其路径的所有权值和/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * Tree...
分类:其他好文   时间:2014-08-06 21:59:32    阅读次数:184
924条   上一页 1 ... 82 83 84 85 86 ... 93 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!