码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
Binary Tree Inorder Traversal ——LeetCode
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:其他好文   时间:2015-04-23 23:19:15    阅读次数:147
Scramble String -- leetcode
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representation of s1 = "great": great / gr ...
分类:其他好文   时间:2015-04-23 17:40:47    阅读次数:205
LeetCode Unique Binary Search Trees II
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST's shown below. 1 3 ...
分类:其他好文   时间:2015-04-23 17:35:14    阅读次数:145
OJ练习25——T110 Balanced Binary Tree
判断一棵树是否是平衡树。平衡数的意思是,树左右子树高度之差不能超过1.【思路】递归判断每个子树是否是平衡数,需要调用高度计算的函数。【my code】bool isBalanced(TreeNode *root) { if(root==NULL) return t...
分类:其他好文   时间:2015-04-23 17:17:21    阅读次数:181
leetcode || 110、Balanced Binary Tree
problem: 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 ev...
分类:其他好文   时间:2015-04-23 15:47:04    阅读次数:166
Populating Next Right Pointers in Each Node Total Accepted: 46429 Total Submissions: 128383
题目来自:LeetCode https://leetcode.com/problems/populating-next-right-pointers-in-each-node/ Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; ...
分类:其他好文   时间:2015-04-23 13:22:50    阅读次数:143
先序和中序建立二叉树
Construct Binary Tree from Preorder and Inorder Traversal   Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in th...
分类:其他好文   时间:2015-04-23 13:16:06    阅读次数:124
leetcode || 107、Binary Tree Level Order Traversal II
problem: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree...
分类:其他好文   时间:2015-04-23 11:02:24    阅读次数:163
Leetcode16: Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11' has binary representation 000000...
分类:其他好文   时间:2015-04-23 10:59:45    阅读次数:206
leetcode || 108、Convert Sorted Array to Binary Search Tree
problem: Given an array where elements are sorted in ascending order, convert it to a height balanced BST. Hide Tags  Tree Depth-first Search 题意:将一个递增的序列 转换成一棵 平衡查找二叉树 ...
分类:其他好文   时间:2015-04-23 10:59:34    阅读次数:201
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!