You are viewing a single comment's thread. Return to all comments →
C++ Solution:
queue<Node*> myQueue; if(root == NULL) return; else { Node* curr = root; myQueue.push(curr); while(myQueue.size() != 0) { curr = myQueue.front(); cout << curr->data << " "; if(curr->left != NULL) myQueue.push(curr->left); if(curr->right != NULL) myQueue.push(curr->right); myQueue.pop(); } }
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 →
C++ Solution: