Adding a code to serialize a binary tree