码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
【LeetCode】Find Minimum in Rotated Sorted Array 解题报告
【题目】 Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. You may assume no duplicate...
分类:其他好文   时间:2014-10-20 11:51:28    阅读次数:239
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-10-20 11:21:40    阅读次数:184
Binary Tree Preorder Traversal and Binary Tree Postorder Traversal
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:其他好文   时间:2014-10-19 22:42:10    阅读次数:223
Path Sum
1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNo...
分类:其他好文   时间:2014-10-19 21:11:49    阅读次数:189
Erlang--位语法
(一)基本概念: ??? 1、二进制型: 二进制的原始数据 ??? 2、Erlang虚拟机对二进制型的输入、输出和消息传递都做了优化,十分高效。 ??? 3、二进制型里的位数如果是8的倍数,则称为二进制型(binary) ??...
分类:其他好文   时间:2014-10-19 15:44:19    阅读次数:457
leetcode:Minimum Depth of Binary Tree【Python版】
1、类中递归调用添加self;2、root为None,返回03、root不为None,root左右孩子为None,返回14、返回l和r最小深度,l和r初始为极大值; 1 # Definition for a binary tree node 2 # class TreeNode: 3 # ...
分类:编程语言   时间:2014-10-19 10:13:07    阅读次数:222
leetcode:Path Sum【Python版】
1、类中递归调用函数需要加self# Definition for a binary tree node# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# ...
分类:编程语言   时间:2014-10-19 10:11:52    阅读次数:200
Implement Insert and Delete of Tri-nay Tree
Implement insert and delete in a tri-nary tree. A tri-nary tree is much like a binary tree but with three child nodes for each parent instead of two -...
分类:其他好文   时间:2014-10-19 02:40:16    阅读次数:236
LeetCode Binary Tree Level Order Traversal
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...
分类:其他好文   时间:2014-10-19 01:21:45    阅读次数:204
leetcode:Same Tree【Python版】
1、p或q为None的情况用开始的两个if语句进行判断;2、类中递归调用函数需要使用self进行调用;3、代码很简洁,最后几行通过同时为None和同时非None的条件进行判断; 1 # Definition for a binary tree node 2 # class TreeNode: 3 ....
分类:编程语言   时间:2014-10-19 01:17:13    阅读次数:329
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!