The tree I have is in no way sorted, so A < B < C does not hold. Sorry if I didn't mention this, but I thought it was implied by *NOT* saying it was a sorted tree...Quote:
but if we say that nodes to the right of its parent are "greater than" the parent and nodes that are left of its parent are "less than" the parent, then doesn't the first tree demonstrate that C is "greater than" A and B, and as demonstrated by the second tree that C is "less than" both A and B. These two trees contradict eachother if the meanings of A, B, and C are the same in both trees.
Well, I am storing it in a way it can be completely reconstructed, using these special characters. At least I'm pretty sure it can, which was one of the reasons for this post.Quote:
you expect to read the data from a file and restore an incomplete structure. That's not really going to work well unless you save the data with corresponding structure locations that a specialized rebuild algorithm can use to place the nodes correctly
Does it really matter why? I have an arbitrary not neccessarily balanced, not neccessarily sorted, not neccessarily full binary tree. I want to be able to save it to a file then load and reconstruct it EXACTLY as it was at a later time. This tree-in-file thing is NOT a substitute for having a tree of real pointers and nodes in memory. It's for storage.Quote:
Well, to me it seems that you wanna do the hard work instead of letting your program do all the processing. I mean why you want a tree in your file?
If you must have a concrete situation it's for a huffman tree for data compression, to create uniquely decodable prefix codes.
Thanks for your trust LloydUzari, I'll go with your advice and follow my advice to avoid other confusing advice :D.