The following diagram shows serialization where ')' is used as end of children marker. The idea is to store an 'end of children' marker with every node. An N-ary tree is represented by storing an array or list of child pointers with every node. In an N-ary tree, there are no designated left and right children. This post is mainly an extension of below post. Deserialization is reading tree back from file. The structure of tree must be maintained. How to serialize and deserialze it? Serialization is to store tree in a file so that it can be later restored. Given an N-ary tree where every node has at-most N children.