private static ArrayList<TreeNode> dfs (int start, int end) {
    	ArrayList<TreeNode> ret = new ArrayList<TreeNode>();
    	if (start > end) {
    		ret.add(null);//don't understand
    		return ret;
    	}
    	else {
    		for (int i = start; i <= end; ++i) {
    			ArrayList<TreeNode> left = dfs(start, i-1);
    			ArrayList<TreeNode> right = dfs(i+1, end);
    			
    			for (int m = 0; m < left.size(); ++m) {
    				for (int n = 0; n < right.size(); ++n) {
    					TreeNode root = new TreeNode(i+1);//use the ith elem as root
    					root.left = left.get(m);
    					root.right = right.get(n);
    					ret.add(root);
    				}
    			}
    		}
    		return ret;
    	}
    }