u can use a queen in bfs traverse
void visit(Node* r)
{
}
void BF_Traverse(Node* r)
{
queen<Node*> q;
q.push(r);
while(!q.empty())
{
Node* t = *q.front();
q.pop();
visit(t);
if(t->left !=0)
q.push(t->left);
if(t->right!=0)
q.push(t->right);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---