package algorithm.leet_136_150;

import algorithm.TreeNode;

import java.util.List;

/**
 * Created by shu on 5/14/2016.
 */
public class BinaryTreePostorderTraversal_145 {
    public List<Integer> postorderTraversal(TreeNode root) {

    }
}

@@ -54,16 +54,73 @@
 eNode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.LinkedList;%0A
 import j
@@ -284,16 +284,760 @@
 root) %7B%0A
+        List%3CInteger%3E res = new ArrayList%3CInteger%3E();%0A        if (root == null) %7B%0A            return res;%0A        %7D%0A        LinkedList%3CTreeNode%3E stack = new LinkedList%3CTreeNode%3E();%0A        TreeNode pre = null;%0A        while (root != null %7C%7C !stack.isEmpty()) %7B%0A            if (root != null) %7B%0A                stack.push(root);%0A                root = root.left;%0A            %7D else %7B%0A                TreeNode peekNode = stack.peek();%0A                if (peekNode.right != null && pre != peekNode.right) %7B%0A                    root = peekNode.right;%0A                %7D else %7B%0A                    stack.pop();%0A                    res.add(peekNode.val);%0A                    pre = peekNode;%0A                %7D%0A            %7D%0A        %7D%0A        return res;
 %0A    %7D%0A%7D

Check in code