码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
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-12-03 21:12:08    阅读次数:201
Binary Tree Level Order Traversal II
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:其他好文   时间:2014-12-03 21:09:03    阅读次数:119
Sum Root to Leaf Numbers
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:其他好文   时间:2014-12-03 19:03:24    阅读次数:169
【LeetCode】Validate Binary Search Tree 解题报告
今天CSDN博客发生异常,折腾了大半天终于发出了这篇博文。 【题目】 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 no...
分类:其他好文   时间:2014-12-03 17:14:52    阅读次数:219
[leetcode]Populating Next Right Pointers in Each Node
问题描述: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate each next pointer to point to its next right nod...
分类:其他好文   时间:2014-12-03 00:30:06    阅读次数:198
[leetcode]Unique Binary Search Trees
问题描述: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1...
分类:其他好文   时间:2014-12-03 00:29:34    阅读次数:136
[leetcode]Convert Sorted List to Binary Search Tree
问题描述: 基本思路: 代码: public TreeNode subSortedToBST(Vector vec, int begin ,int end) //Java { if(begin == end) { TreeNode node = new TreeNode(vec.get(begin));...
分类:其他好文   时间:2014-12-03 00:29:23    阅读次数:158
【LeetCode】Binary Tree Inorder Traversal (2 solutions)
Binary Tree Inorder TraversalGiven a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:其他好文   时间:2014-12-02 22:10:23    阅读次数:138
创建二叉查找树的完整C代码
基本概念 二叉查找树(Binary Search Tree),又称二叉排序树(Binary Sort Tree),亦称二查搜索书。 它或者是一棵空树;或者是具有下列性质的二叉树: (1)若左子树不空,则左子树上所有结点的值均小于它的根结点的值; (2)若右子树不空,则右子树上所有结点的值均大于它的根结点的值; (3)左、右子树也分别为二叉排序树; 简单的说就是:左孩子 因此...
分类:其他好文   时间:2014-12-02 20:53:19    阅读次数:222
Leetcode: Scramble String
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:其他好文   时间:2014-12-02 20:43:38    阅读次数:190
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!