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
|
232 Discussions
|
Please Login in order to post a comment
My Java solution with o(n) time complexity and o(h) space complexity:
Python
Very Simple Recursive JavaScript Solution:
const resp = []
function helperFunc(root) { if(!root) return; resp.push(root.data) helperFunc(root.right); helperFunc(root.left); }
function postOrder(root) { helperFunc(root); console.log(resp.reverse().join(' ')); }
It is asking how to use process.stdout.write to print your answer on JS, not testing the Tree concept.
Haskell