You are viewing a single comment's thread. Return to all comments →
//for cpp if(root == NULL) return; queue q; q.push(root);
while(!q.empty()){ Node* current = q.front(); q.pop(); cout<<current->data<<" "; if(current->left!=NULL) q.push(current->left); if(current->right!=NULL) q.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 →
//for cpp if(root == NULL) return; queue q; q.push(root);