码迷,mamicode.com
首页 >  
搜索关键字:traversal    ( 1649个结果
Leetcode dfs Construct Binary Tree from Inorder and Postorder Traversal
Construct Binary Tree from Inorder and Postorder Traversal  Total Accepted: 14363 Total Submissions: 54254My Submissions Given inorder and postorder traversal of a tree, construct the bina...
分类:其他好文   时间:2014-09-11 07:41:51    阅读次数:149
Binary Tree Level Order Traversal II 解题思路
思路:与Binary Tree Level Order Traversal I几乎一样。只是最后将结果存放在栈里,然后在栈里再传给向量即可。再次总结思路:两个queue,先把第一个放进q1,循环q1是否为空,不为空就读取并出列,如果root有孩子就放入q2,最后清空q2。注意:for循环的时候不要使...
分类:其他好文   时间:2014-09-10 23:38:11    阅读次数:274
Leetcode dfs Construct Binary Tree from Preorder and Inorder Traversal
Construct Binary Tree from Preorder and Inorder Traversal  Total Accepted: 14824 Total Submissions: 55882My Submissions Given preorder and inorder traversal of a tree, construct the binary...
分类:其他好文   时间:2014-09-10 14:16:11    阅读次数:158
Binary Tree Level Order Traversal <leetcode>
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:其他好文   时间:2014-09-09 11:32:38    阅读次数:240
Binary Tree Postorder Traversal <leetcode>
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No...
分类:其他好文   时间:2014-09-07 14:44:25    阅读次数:208
PAT 1086 Tree Traversals Again
PAT 1086 Tree Traversals Again题目:An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that wh...
分类:其他好文   时间:2014-09-07 11:02:25    阅读次数:183
LeetCode--Binary Tree Level Order Traversal
用两个队列实现,交叉使用,达到判断层的目的 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right...
分类:其他好文   时间:2014-09-06 23:47:44    阅读次数:261
Leetcode dfs Binary Tree Postorder Traversal II
Sudoku Solver  Total Accepted: 11752 Total Submissions: 56537My Submissions Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character...
分类:其他好文   时间:2014-09-06 22:37:04    阅读次数:244
Leetcode bfs&dfs Binary Tree Postorder Traversal II
Binary Tree Level Order Traversal II  Total Accepted: 16983 Total Submissions: 54229My Submissions Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie...
分类:其他好文   时间:2014-09-05 18:22:41    阅读次数:212
Leetcode bfs&dfs Binary Tree Postorder Traversal
Binary Tree Level Order Traversal  Total Accepted: 20571 Total Submissions: 66679My Submissions Given a binary tree, return the level order traversal of its nodes' values. (ie, from left t...
分类:其他好文   时间:2014-09-05 18:22:21    阅读次数:271
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!