private void serializeUtil(Node root, StringBuffer buff) {
        if (root == null) {
            buff.append("%,");
            return;
        }

        buff.append(root.data).append(",");
        if (root.left != null || root.right != null) {
            buff.append("$,");
            serializeUtil(root.left, buff);
            serializeUtil(root.right, buff);
        } else {
            return;
        }

    }
Serialize Tree using preorder DFS
@param root
@return
src/com/interview/tree/SerializeDeserializeBinaryTree.java