码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
LeetCode103 BinaryTreeZigzagLevelOrderTraversal(二叉树Z形层次遍历) Java题解
题目: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Give...
分类:编程语言   时间:2015-07-09 17:59:13    阅读次数:112
leetcode-230-Kth Smallest Element in a BST
Kth Smallest Element in a BST   Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note:  You may assume k is always valid, 1 ≤ k ≤ BST's to...
分类:其他好文   时间:2015-07-09 14:40:05    阅读次数:122
【LeetCode 144_二叉树_遍历】Binary Tree Preorder Traversal
解法一:非递归 1 vector preorderTraversal(TreeNode* root) 2 { 3 vector res; 4 if (root == NULL) 5 return res; 6 7 stack node_stack; 8 ...
分类:其他好文   时间:2015-07-09 13:09:15    阅读次数:103
LeetCode之“树”: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...
分类:其他好文   时间:2015-07-09 13:04:42    阅读次数:91
Minimum Depth of Binary Tree
https://leetcode.com/problems/minimum-depth-of-binary-tree/ 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 ...
分类:其他好文   时间:2015-07-09 12:50:40    阅读次数:102
Populating Next Right Pointers in Each Node
https://leetcode.com/problems/populating-next-right-pointers-in-each-node/ 1 /** 2 * Definition for binary tree with next pointer. 3 * struct TreeLi.....
分类:其他好文   时间:2015-07-09 12:46:18    阅读次数:91
【LeetCode】221. Maximal Square
Maximal SquareGiven a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the ...
分类:其他好文   时间:2015-07-09 12:41:13    阅读次数:103
LeetCode145 Binary Tree Postorder Traversal Java题解(递归 迭代)
题目: Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [3,2,1]. 解题: 递归的还是和前面中...
分类:编程语言   时间:2015-07-09 11:16:06    阅读次数:179
Flatten Binary Tree to Linked List
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...
分类:其他好文   时间:2015-07-08 22:41:17    阅读次数:187
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 i...
分类:其他好文   时间:2015-07-08 22:28:32    阅读次数:167
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!