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