Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void printTreeBfs(tree *tr)
- {
- queue<tree*> bfs;
- bfs.push(tr);
- tree *check;
- while (!bfs.empty())
- {
- check = bfs.front();
- cout << check->data << " ";
- bfs.pop();
- if (check->left)
- bfs.push(check->left);
- if (check->right)
- bfs.push(check->right);
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement