You are viewing a single comment's thread. Return to all comments →
void levelOrder(Node * root){ vector<Node*> oQ; if (nullptr != root) { oQ.push_back(root); for(int i=0; i<oQ.size(); i++) { cout<<oQ[i]->data<<" "; if (nullptr != oQ[i]->left) oQ.push_back(oQ[i]->left); if (nullptr != oQ[i]->right) oQ.push_back(oQ[i]->right); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 23: BST Level-Order Traversal
You are viewing a single comment's thread. Return to all comments →