I have a binary tree similar to this

the object that represents it is as follows (java)
public class node { private String value = ""; private TreeNode aChild; private TreeNode bChild; .... }
I want to read data and build a tree from a string.
So I wrote a little method to serialize it, and I have it like this
(Parent-left-right)
0, null, O @ 1, left, A @ 2, left, C @ 3, left, D @ 4, left, E @ 4, right, F @ 1, right, B @
Then I read it and I got it as a list - objects in this order O, A, C, D, E, F, B
And now my question is: how to build a tree?
repeat and put it on the stack, turn?
should serialize a different order?
(basically I want to learn the best practices for building a tree from string data)
can you refer to the link on this topic?
source share