码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
Leetcode Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:其他好文   时间:2015-09-14 07:02:20    阅读次数:98
Leetcode Invert Binary Tree
Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1解题思路:方法一: recursion 交换当前左右节点,并直接调用递归即可方...
分类:其他好文   时间:2015-09-14 07:01:34    阅读次数:122
[LeetCode#250] Count Univalue Subtrees
Problem:Given a binary tree, count the number of uni-value subtrees.A Uni-value subtree means all nodes of the subtree have the same value.For example...
分类:其他好文   时间:2015-09-14 07:01:23    阅读次数:129
[Leetcode]unique binary search trees
https://leetcode.com/problems/unique-binary-search-trees/动归2015/9/14上午1:37:45分析:二叉搜索树,节点数为N,那么就有根节点为1时,左侧为0个节点,右侧有n-1个节点,这种情况有F(0)*F(n-1);根节点为2时,左侧为1个...
分类:其他好文   时间:2015-09-14 06:59:05    阅读次数:108
Leetcode Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:其他好文   时间:2015-09-14 01:55:44    阅读次数:139
[LeetCode]Symmetric Tree
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric...
分类:其他好文   时间:2015-09-14 01:53:15    阅读次数:121
[LeetCode][JavaScript]Binary Tree Preorder Traversal
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:编程语言   时间:2015-09-14 00:17:57    阅读次数:187
二叉搜索树
定义二叉搜索树(Binary Search Tree)或称二叉查找树,也称二叉排序树(Binary Sort Tree)。它或者是一棵空树,或者是具有下列性质的二叉树:若左子树不空。则左子树上全部节点的值均小于它的根节点的值;若右子树不空。则右子树上全部节点的值均大于它的根节点的值;左、右子树也分别...
分类:其他好文   时间:2015-09-13 17:16:04    阅读次数:148
LintCode "Subtree"
A variation to Binary Tree iteration.class Solution { bool isSame(TreeNode *p1, TreeNode *p2) { if (!p1 && !p2) return true; if( (...
分类:其他好文   时间:2015-09-13 14:40:02    阅读次数:300
树状数组初步
树状数组(Binary Indexed Tree(BIT), Fenwick Tree)是一个查询和修改复杂度都为log(n)的数据结构。主要用于查询任意两位之间的所有元素之和,但是每次只能修改一个元素的值;经过简单修改可 以在log(n)的复杂度下进行范围修改,但是这时只能查询其中一个元素的值,且...
分类:编程语言   时间:2015-09-12 19:00:10    阅读次数:291
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!