You are viewing a single comment's thread. Return to all comments →
Javascript:
function postOrder(root) { let result = [] let values = "" function dfsPostTraverse(currentNode){ if(currentNode == null){ return; } dfsPostTraverse(currentNode.left) dfsPostTraverse(currentNode.right) result.push(currentNode.data) } dfsPostTraverse(root) for(let i=0; i<result.length; i++){ values += result[i] + " " } console.log(values) }
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Postorder Traversal
You are viewing a single comment's thread. Return to all comments →
Javascript: