码迷,mamicode.com
首页 >  
搜索关键字:binary not found    ( 17983个结果
LeetCode: Convert Sorted Array to Binary Search Tree [108]
【题目】 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 【题意】 给定一个已排序的数组(不存在重复元素),将它转换成一棵平衡二叉搜索树。 【思路】 由于平衡二叉树要求左右子树的高度差绝对值相遇等于1,也就是说左右子树尽可能包含相同数目节点。 则使用二分法来解本题即可。...
分类:其他好文   时间:2014-06-20 11:03:31    阅读次数:246
LeetCode: Balanced Binary Tree [110]
【题目】 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1. 【题意】 判断二叉树是否是平衡二叉树 【思路】 平衡二...
分类:其他好文   时间:2014-06-20 11:02:54    阅读次数:173
LeetCode: Path Sum II [113]
【题目】 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 = 22, 5 / 4 8 / / 11 13 4 ...
分类:其他好文   时间:2014-06-20 10:53:08    阅读次数:181
leetcode -day27 Recover Binary Search Tree & Interleaving String
1、 ?? Recover Binary Search Tree Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space is pretty...
分类:其他好文   时间:2014-06-20 10:13:49    阅读次数:243
Balanced Binary Tree
题目 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node...
分类:其他好文   时间:2014-06-20 09:02:56    阅读次数:232
LeetCode: Convert Sorted List to Binary Search Tree [109]
【题目】 Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 【题意】 将一个有序链表转换成平衡二叉树 【思路】 思路跟Convert Sorted Array to Binary Search Tree完全一样...
分类:其他好文   时间:2014-06-07 16:20:05    阅读次数:287
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. For example: Given the below binary t...
分类:其他好文   时间:2014-06-07 15:31:32    阅读次数:179
LeetCode: Path Sum [112]
【题目】 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. For example: Given the below binary tree and sum = 22, 5 / ...
分类:其他好文   时间:2014-06-07 13:57:37    阅读次数:210
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 = 22, 5 ...
分类:其他好文   时间:2014-06-07 13:47:22    阅读次数:191
LeetCode: Flatten Binary Tree to Linked List [114]
【题目】 Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / 2 5 / \ 3 4 6 The flattened tree should look like: 1 2 3 4 \...
分类:其他好文   时间:2014-06-07 11:37:00    阅读次数:153
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!