serializeHelper
that takes a TreeNode as input and returns a string representation of the tree.
serializeHelper
on the left and right children.serialize
method that calls serializeHelper
starting from the root.deserializeHelper
that takes a list of strings (tree values) and returns the root of the reconstructed binary tree.
deserializeHelper
for the left and right children.deserialize
method that splits the input string by commas into a list and calls deserializeHelper
.