public static List<Double> averageTreeLevel(TreeNode root) {
		List<TreeNode> p=new ArrayList<>();p.add(root);
		List<Double> rel=new ArrayList<>();
		while (!p.isEmpty()) {
			List<TreeNode> c=new ArrayList<>();
			double sum=0;
			for (ListIterator<TreeNode>iter=p.listIterator();iter.hasNext();) {
				TreeNode node=iter.next();
				sum+=node.val;
				if (node.left!=null)c.add(node.left);
				if (node.right!=null)c.add(node.right);
			}
			rel.add(sum/p.size());
			p=c;
		}
		return rel;
	}