You are viewing a single comment's thread. Return to all comments →
function levelOrder(root) { let node, list = [root], list_order = '' while (list.length) { node = list.shift() if (node) { list_order += `${node.data} ` if (node.left) list.push(node.left) if (node.right) list.push(node.right) } } console.log((list_order).trim()) }
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Level Order Traversal
You are viewing a single comment's thread. Return to all comments →