Tree: Level Order Traversal

  • + 0 comments
    1. if(root==NULL) return; queueq; q.push(root); while(!q.empty()){ Node*current=q.front(); q.pop(); cout<data<<" "; if(current->left!=NULL){ q.push(current->left); } if(current->right!=NULL){ q.push(current->right); } }