Easy BFS JAVA
```\n// Encodes a tree to a single string.\n    public String serialize(TreeNode root) {\n        Queue q=new LinkedList();\n        StringBuilder s=new StringB
```\n// Encodes a tree to a single string.\n    public String serialize(TreeNode root) {\n        Queue<TreeNode> q=new LinkedList<TreeNode>();\n        StringBuilder s=new StringBuilder();\n        if(root==null)\n        return "*-";\n        q.add(root);\n        while(!q.isEmpty()){\n            TreeNode temp=q.remove();\n            if(temp==null)\n            s.append("*-");\n            else{\n            s.append(temp.val+"-");\n            q.add(temp.left);\n            q.add(temp.right);\n            }\n        }\n        \n        return s.toString();\n    }\n\n// Decodes your encoded data to tree.\n    public TreeNode deserialize(String data) {\n       String[] val=data.split("-");\n       \n       if(val.length==0)\n       return null;\n       if(val[0].equals("*"))\n       return null;\n       Queue<TreeNode> q=new LinkedList<TreeNode>();\n       TreeNode root=new TreeNode(Integer.parseInt(val[0]));\n       q.add(root);\n       for(int i=1;i<val.length;i=i+2){\n           TreeNode Node=q.remove();\n           if(!val[i].equals("*")){\n               Node.left=new TreeNode(Integer.parseInt(val[i]));\n               q.add(Node.left);\n           }\n           if(i+1<val.length && !val[i+1].equals("*")){\n               Node.right=new TreeNode(Integer.parseInt(val[i+1]));\n               q.add(Node.right);\n           }\n       }\n    \n       return root;\n    }
[]