码迷,mamicode.com
首页 >  
搜索关键字:inorder    ( 706个结果
[leetcode]_Binary Tree Inorder Traversal
题目:二叉树的中序遍历。思路:用递归来写中序遍历非常简单。但是题目直接挑衅说,----->"Recursive solution is trivial"。好吧。谁怕谁小狗。递归代码: 1 List inOrder = new ArrayList(); 2 3 public ...
分类:其他好文   时间:2014-06-29 12:55:36    阅读次数:176
Binary Tree Inorder Traversal
题目 Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,3,2]. Note: Recur...
分类:其他好文   时间:2014-06-20 10:22:00    阅读次数:221
leetcode -day23 Construct Binary Tree from Inorder and Postorder Traversal & Construct Binary Tree f
1、 ?? Construct Binary Tree from Inorder and Postorder Traversal Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in...
分类:其他好文   时间:2014-06-03 03:13:59    阅读次数:195
LeetCode: Binary Tree Inorder Traversal [094]
【题目】 Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, could you do it iteratively? confused what "{1,#,2...
分类:其他好文   时间:2014-06-01 13:01:23    阅读次数:279
Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Definiti...
分类:其他好文   时间:2014-05-30 16:12:22    阅读次数:288
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 the tree./** * Definitio...
分类:其他好文   时间:2014-05-30 16:02:40    阅读次数:289
Leetcode | Construct Binary Tree from Inorder and (Preorder or Postorder) Traversal
Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume...
分类:其他好文   时间:2014-05-19 18:43:40    阅读次数:177
LeetCode--Symmetric Tree
对于本题,想到一个中序遍历后,判别是否为回文串的方法,却WA多次 class Solution { public: vector vectorValue; void inOrder(TreeNode* root) { if(root!=NULL) { inOrder(root->left);...
分类:其他好文   时间:2014-05-18 06:38:58    阅读次数:294
Leetcode 树 Binary Tree Inorder Traversal
题意:中序遍历 思路:采用递归实现。因为函数声明是返回一个vector,所以每个子树返回的是该子树的中序遍历的结果 按照 左、根、右的次序把根和左右子树的vector合并起来就可以了...
分类:其他好文   时间:2014-05-15 06:21:09    阅读次数:255
[leetcode]Binary Tree Inorder Traversal @ Python
原题地址:http://oj.leetcode.com/problems/binary-tree-inorder-traversal/题意:二叉树的中序遍历。解题思路:这道题用递归解不难,所以应该考察的是非递归求解二叉树的中序遍历。我们使用一个栈来解决问题。比如一颗二叉树为{1,2,3,4,5,6,...
分类:编程语言   时间:2014-05-12 12:48:36    阅读次数:316
706条   上一页 1 ... 68 69 70 71 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!