I have the algorithm for void leveltraversal(ostream& out);
but i am not sure how to call it in main () . In my Assignment we are not allowed to change the header file. Is there a way to call it without overloading it?
Update:
void BST::levelTraversal(ostream& out){
queue<BST::BinNode*> q;
BinNode* cur = myRoot;
BinNode* top = NULL;
q.push(cur);
while(q.empty() != false){
top = q.front();
if(top->left != NULL){
q.push(top->left);
}
if(top->right !=NULL){
q.push(top->right);
}
out<<top->data;
q.pop();
}
}