/*
struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
	TreeNode(int x) :
			val(x), left(NULL), right(NULL) {
	}
};*/
/*
    levelOrder
*/
class Solution {
public:
    vector<int> PrintFromTopToBottom(TreeNode* root) {
        vector<int> ret;
        if(!root) {
            return ret;
        }
        queue<TreeNode *>que;
        que.push(root);
        while(!que.empty()) {
            int size = que.size();
            while(size--) {
                TreeNode *front = que.front();
                ret.push_back(front->val);
                que.pop();
                if (front->left) {
                    que.push(front->left);
                }
                if (front->right) {
                    que.push(front->right);
                }
            }
        }
        return ret;
        
    }
};