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.
voidlevelOrder(Node*root){//Write your code herequeue<Node*>q;if(root!=NULL){q.push(root);while(q.size()){cout<<q.front()->data<<" ";if(q.front()->left!=NULL)q.push(q.front()->left);if(q.front()->right!=NULL)q.push(q.front()->right);q.pop();}}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 23: BST Level-Order Traversal
You are viewing a single comment's thread. Return to all comments →
C++