码迷,mamicode.com
首页 >  
搜索关键字:binary    ( 11734个结果)
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
Leetcode[]-Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() and hasN...
分类:其他好文   时间:2015-06-13 09:56:01    阅读次数:100
Binary Tree Preorder Traversal
树的遍历当初觉得难死,现在还好public class Solution { public ArrayList preorderTraversal(TreeNode root) { ArrayList res = new ArrayList(); if(root=...
分类:其他好文   时间:2015-06-13 07:35:26    阅读次数:118
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!