|  | @@ -12,7 +12,7 @@ import java.util.LinkedList;
 | 
	
		
			
				|  |  |  public class Codec {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Encodes a tree to a single string.
 | 
	
		
			
				|  |  | -    public String serialize(TreeNode root) {
 | 
	
		
			
				|  |  | +    public String serialize(TreeNode root) { // Level-order traversal
 | 
	
		
			
				|  |  |          StringBuilder sb = new StringBuilder();
 | 
	
		
			
				|  |  |  		LinkedList<TreeNode> list = new LinkedList<TreeNode>();
 | 
	
		
			
				|  |  |  		list.add(root);
 | 
	
	
		
			
				|  | @@ -28,14 +28,14 @@ public class Codec {
 | 
	
		
			
				|  |  |  			list.add(curr.left);
 | 
	
		
			
				|  |  |  			list.add(curr.right);
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		sb.deleteCharAt(sb.length()-1);
 | 
	
		
			
				|  |  | +		sb.deleteCharAt(sb.length()-1); // Remove the last ','
 | 
	
		
			
				|  |  |  		return sb.toString();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // Decodes your encoded data to tree.
 | 
	
		
			
				|  |  |      public TreeNode deserialize(String data) {
 | 
	
		
			
				|  |  |  		String[] strs = data.split(",");
 | 
	
		
			
				|  |  | -		if (strs[0].equals("null")) return null;
 | 
	
		
			
				|  |  | +		if (strs[0].equals("null")) return null; // Root is null
 | 
	
		
			
				|  |  |  		TreeNode root = new TreeNode(Integer.parseInt(strs[0]));
 | 
	
		
			
				|  |  |  		LinkedList<TreeNode> list = new LinkedList<TreeNode>();
 | 
	
		
			
				|  |  |  		list.add(root);
 |