码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
Leetcode[98]-Validate Binary Search Tree
Validate Binary Search TreeGiven 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 less than...
分类:其他好文   时间:2015-06-13 14:21:53    阅读次数:103
Leetcode[103]-Binary Tree Zigzag Level Order Traversal
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: Given binary tree...
分类:其他好文   时间:2015-06-13 14:20:17    阅读次数:121
Leetcode[114]-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 6The flattened tree should look like: 1 2...
分类:其他好文   时间:2015-06-13 14:19:28    阅读次数:86
Leetcode[107]-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}, 3...
分类:其他好文   时间:2015-06-13 12:57:50    阅读次数:98
Binary Tree Postorder Traversal
http://bookshadow.com/weblog/2015/01/19/leetcode-binary-tree-postorder-traversal/http://bookshadow.com/weblog/2015/01/19/binary-tree-post-order-traver...
分类:其他好文   时间:2015-06-13 12:36:30    阅读次数:111
Leetcode[244]-Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes’ values.For example: Given binary tree{1,#,2,3}, 1 2 / 3return [1,2,3].递归遍历:/**C++ * Definition for a binary tree n...
分类:其他好文   时间:2015-06-13 11:27:51    阅读次数:143
LeetCode Invert Binary Tree
LeetCode Invert Binary Tree题目思路没什么思路可言; 真不敢相信他写不出;代码struct TreeNode* invertTree(struct TreeNode* root) { if (root == NULL) return root; invertTree(root->left); invertTree(root->right);...
分类:其他好文   时间:2015-06-13 11:27:30    阅读次数:234
Leetcode[145]-Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 2 / 3return [3,2,1].Note: Recursive solution is trivial, could...
分类:其他好文   时间:2015-06-13 11:23:14    阅读次数:113
Leetcode[102]-Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example: Given binary tree {3,9,20,#,#,15,7}, 3 / 9 20 / 1...
分类:其他好文   时间:2015-06-13 11:20:46    阅读次数:114
Leetcode[96]-Unique Binary Search Trees
Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example, Given n = 3, there are a total of 5 unique BST’s. 1 3 3 2 1 \ /...
分类:其他好文   时间:2015-06-13 09:58:12    阅读次数:104
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!