/*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};*/
class Solution {
public:
vector<int> PrintFromTopToBottom(TreeNode* root) {
queue<TreeNode*>q1;
vector<int>re;
TreeNode*p1=root;
q1.push(p1);
if(root == NULL) return re;
while(!q1.empty()){
p1=q1.front();//注意,这里是p1。
re.push_back(p1->val);
q1.pop();
if(p1->left!=NULL){
q1.push(p1->left);
}
if(p1->right!=NULL){
q1.push(p1->right);
}
}
return re;
}
};