class Solution {
public List<Integer> printFromTopToBottom(TreeNode root) {
List<Integer> arr= new ArrayList<Integer>();
if(root==null)
return arr;
Queue<TreeNode> q=new LinkedList<TreeNode>();
q.add(root);
while(!q.isEmpty())
{
TreeNode node=q.poll();
arr.add(node.val);
if(node.left!=null)
q.add(node.left);
if(node.right!=null)
q.add(node.right);
}
return arr;
}
}