We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Tree: Postorder Traversal
Tree: Postorder Traversal
Sort by
recency
|
227 Discussions
|
Please Login in order to post a comment
Javascript:
solution for java
public static void postOrder(Node root) {
Solution with Javascript:
function postOrder(root) { const stack = iterate(root)
console.log(stack.join(' ')) }
function iterate(root, stack = []) { if (root == null) { return }
iterate(root.left, stack) iterate(root.right, stack)
stack.push(root.data)
return stack } `