Skip to content

Files

Latest commit

238dacf · May 30, 2020

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
May 30, 2020
Dec 1, 2019
Dec 1, 2019

<< [03] Serialize a tree into a string and back >>

Given the root to a binary tree, implement serialize(root), which serializes the tree into a string, and deserialize(s), which deserializes the string back into the tree.

Example:

>>> serialize, deserialize = coding_problem_03()
>>> s = '>>> YOUR OWN TREE ENCODING HERE <<<'
>>> isinstance(s, str)
True

>>> s == serialize(deserialize(s))
True