码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
sicily 1156 二叉树的遍历 前序遍历,递归,集合操作
1156. Binary treeConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionYour task is very simple: Given a binary tree, every node of which conta...
分类:其他好文   时间:2014-10-04 03:10:25    阅读次数:202
[Leetcode][JAVA] Binary Tree Preorder Traversal, Binary Tree Inorder Traversal, Binary Tree Postorder Traversal
Binary Tree PreOrder Traversal:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:编程语言   时间:2014-10-04 02:51:25    阅读次数:285
Leetcode:minimum_depth_of_binary_tree题解
和求最深二叉树相似,给定一个二叉树,求它的最小深度。最小深度是沿从根节点,到叶节点最短的路径。...
分类:其他好文   时间:2014-10-04 01:58:35    阅读次数:154
Leetcode:maximum_depth_of_binary_tree题解
给定一个二叉树,求它的最大深度。最大深度是沿从根节点,到叶节点最长的路径。...
分类:其他好文   时间:2014-10-04 01:10:05    阅读次数:186
【Leetcode】Binary Tree Traversal
把三个二叉树遍历的题放在一起了。递归写法太简单,就不再实现了,每题实现了两种非递归算法。一种是利用栈,时间和空间复杂度都是O(n)。另一种是借助线索二叉树,也叫Morris遍历,充分利用树中节点的空指针域。先序:Binary Tree Preorder TraversalGiven a binary...
分类:其他好文   时间:2014-10-03 23:07:55    阅读次数:341
leetcode - Binary Tree Level Order Traversal II
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 {3,9,20,#,#,15,7}, ...
分类:其他好文   时间:2014-10-03 19:41:45    阅读次数:189
leetcode - Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. /** * Definition for singly-linked list. * struct ListNode { * int val; * Lis...
分类:其他好文   时间:2014-10-03 17:21:45    阅读次数:167
leetcode - Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * ...
分类:其他好文   时间:2014-10-03 15:40:04    阅读次数:186
leetcode - 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 never diffe...
分类:其他好文   时间:2014-10-03 13:39:24    阅读次数:205
leetcode - 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 tree and sum ...
分类:其他好文   时间:2014-10-02 18:26:13    阅读次数:174
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!