原文:[LeetCode] Binary Tree Postorder Traversal

Given a binary tree, return thepostordertraversal of its nodes values. For example:Given binary tree , , , , return , , . Note:Recursive solution is trivial, could you do it iteratively 解题思路: 相比于前序遍历 ...

2013-11-10 10:22 0 3113 推荐指数:

查看详情

[leetcode]Binary Tree Postorder Traversal @ Python

原题地址:http://oj.leetcode.com/problems/binary-tree-postorder-traversal/ 题意:实现后序遍历。递归实现比较简单,非递归实现。 解题思路:这道题的迭代求解比先序遍历和后序遍历要麻烦一些。假设一棵树是这样的:                         1                        /  \       ...

Sun May 11 02:40:00 CST 2014 0 2827
LeetCode Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 非递归版本: 用一个栈来模拟递归的情况, 首先思考inorder ...

Sun Oct 28 05:48:00 CST 2012 0 3142
[leetcode]Binary Tree Inorder Traversal @ Python

原题地址:http://oj.leetcode.com/problems/binary-tree-inorder-traversal/ 题意:二叉树的中序遍历。这道题用递归比较简单,考察的是非递归实现二叉树中序遍历。中序遍历顺序为:左子树,根,右子树。如此递归下去。 解题思路:假设树为:                 1                /  \             ...

Sat May 10 19:50:00 CST 2014 0 4451
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM