码迷,mamicode.com
首页 >  
搜索关键字:redundant binary upl    ( 12061个结果
[leetcode]_Balanced Binary Tree
第四道树题,逐渐能写递归了。虽然最后AC的代码还是看了网络,但是距离成功攻克此类问题仅一步之遥。题目:一棵树,判断是否为AVL。(AVL条件:树上任意一点的左右子树的高度差_ 1 ) return false; else return isBalanced(root.lef...
分类:其他好文   时间:2014-05-16 04:04:41    阅读次数:259
[LeetCode] [Add Binary 2012-04-02 ]
Given two binary strings, return their sum (also a binary string).For example, a = "11" b = "1" Return "100".string 的操作,短string补位。两个“0”会输出一个“00”,要特殊处理...
分类:其他好文   时间:2014-05-15 17:47:57    阅读次数:283
Leetcode 数 Add Binary
题意:给定两个二进制字符串,返回它们的和 思路: 1.按最长的循环,短的前面补零 2.因为变量少,不用考虑节省空间,定义为int最行了 3.用二进制可能会快一点。不过实现会麻烦一些 复杂度:时间O(m+n),空间O(m+n)...
分类:其他好文   时间:2014-05-15 13:17:22    阅读次数:222
Leetcode--Validate Binary Search Tree
Problem Description: 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 nodes with keys l...
分类:其他好文   时间:2014-05-15 11:22:21    阅读次数:317
leetcode -day14 Populating Next Right Pointers in Each Node I II
1、 ?? Populating Next Right Pointers in Each Node Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; } Populate...
分类:其他好文   时间:2014-05-15 04:57:36    阅读次数:221
LeetCode--Same Tree
Same Tree  Total Accepted: 16072 Total Submissions: 38790My Submissions Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal i...
分类:其他好文   时间:2014-05-15 04:00:39    阅读次数:319
LeetCode之Unique Binary Search Trees
Unique Binary Search Trees, Given n, how many structurally unique BST's (binary search trees) that store values 1...n?...
分类:其他好文   时间:2014-05-15 02:32:11    阅读次数:245
[leetcode]_Maximum Depth of Binary Tree
第三道树的题目,我还是不会,我擦,怎么递归算法还是不能很好理解。看来还得好好研究下递归算法。题目:求一棵树的最大深度。思路:递归地求取左子树最大深度 和 右子树最大深度,返回较大值即为 整棵树的 最大深度。代码:public int maxDepth(TreeNode root) { ...
分类:其他好文   时间:2014-05-14 23:07:14    阅读次数:373
Pat(Advanced Level)Practice--1043(Is It a Binary Search Tree)
Pat1043代码题目描述:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contain...
分类:其他好文   时间:2014-05-14 22:03:25    阅读次数:487
LeetCode--Binary Tree Preorder Traversal
Binary Tree Preorder Traversal  Total Accepted: 18022 Total Submissions: 51784My Submissions Given a binary tree, return the preorder traversal of its nodes' values. For example: Given b...
分类:其他好文   时间:2014-05-14 20:43:22    阅读次数:242
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!