Min Li's Note
KVM,QEMU, X86 virtualization
Pages
Home
Collection
About
Saturday, October 4, 2014
Binary Tree Postorder Traversal
Problem
Given a binary tree, return the postorder traversal of its nodes' values. For example:
Idea
使用stack实现,压栈时先压右子树再压左子树,只有找到叶子节点时才弹栈,压栈的时候注意把curNode与左右子树分开,这样才能保证从树底返回树顶。
Solution
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment