You are viewing a single comment's thread. Return to all comments →
sharing my c++ solution
void levelOrder(Node * root) { if(root==NULL){return;} queue <Node*> visiting; visiting.push(root); while(!visiting.empty()){ Node* current = visiting.front(); cout<< current->data<<" "; visiting.pop(); if(current->left) visiting.push(current->left); if(current->right) visiting.push(current->right); } }
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 →
sharing my c++ solution