I was wondering how to save a Binary Tree that I have previously created.
Does anyone know how to do it?
Thank you so much.
PD: Here there is a link about how to implement a binary tree, I am using this pice od code:
http://code.activestate.com/recipes/286239-binary-ordered-tree/
One easy solution:
– extend the current class to have a
loadandsavemethod– add a unique id to each node
– implement to do a top down parsing and save each node to a xml with a structure like that
You’re done (if data is easily serialized at least), first node is your tree root.
don’t forget fertilizer and your tree will be reborn even more beautiful