You are viewing a single comment's thread. Return to all comments →
# include<queue> void LevelOrder(node * root) { queue<node *> q; node *temp=root; if(root != NULL) { q.push(root); } while(!q.empty()) { cout<<temp->data<<" "; if(temp->left != NULL) { q.push(temp->left); } if(temp->right != NULL) { q.push(temp->right); } q.pop(); temp= q.front(); } }
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 →