public static ArrayList<LinkedList<TreeNode>> createLinkedListOfTree1(TreeNode root){
    if(root==null)return null;
    ArrayList<LinkedList<TreeNode>> list=new ArrayList<LinkedList<TreeNode>>();

    LinkedList<TreeNode> cur=new LinkedList<TreeNode>();
    cur.add(root);
    
    while(!cur.isEmpty()){
      list.add(cur);
      LinkedList<TreeNode> parent=cur;
      cur=new LinkedList<TreeNode>();
      for(TreeNode node:parent){
        if(node.leftChild!=null){
          cur.add(node.leftChild);
        }
        if(node.rightChild!=null){
          cur.add(node.rightChild);
        }
      }
    }
    return list;
  }