We have a tree like this:
We can convert it to a dotstring representation
, i.e.,
Such a tree can be represented by the preorder sequence of its nodes in which dots (.) are inserted where an empty subtree (nil) is encountered during the tree traversal.
So we can convert the tree in the picture to 'abd..e..c.fg...'
.
If I am about to write a function to do this conversion, what's the BNF
or syntax diagrams
of it?