1#include <bits/stdc++.h>
2using namespace std;
3struct Node { int val; Node *L, *R; };
4
5vector<int> bfs(Node* root) {
6 vector<int> order;
7 if (!root) return order;
8 queue<Node*> q; q.push(root);
9 while (!q.empty()) {
10 Node* n = q.front(); q.pop();
11 order.push_back(n->val);
12 if (n->L) q.push(n->L);
13 if (n->R) q.push(n->R);
14 }
15 return order;
16}