考察点:二叉树
publicList<List<Integer>> levelOrder(TreeNode root) { List<List<Integer>> res =new ArrayList<List<Integer>>(); linkedList<TreeNode> queue = new linkedList<TreeNode>(); if (root == null) { return res; } queue.offer(root); while (queue.size() != 0) { List<Integer> l = new ArrayList<Integer>(); int size = queue.size(); for (int i = 0; i < size; i++) { TreeNode temp = queue.poll(); l.add(temp.val); if (temp.left != null) { queue.offer(temp.left); } if (temp.right != null) { queue.offer(temp.right); } } res.add(l); } return res;}



