I'm currently going through some data structures, and I've come across some data that is stored in a binary tree and I'm not entirely sure of the best way of parsing it.
Essentially the data is stored like this:
Structure 1:
LeftChild: 0xaddress
Structure 2:
LeftChild: 0xaddress
Structure 3:
LeftChild: 0xaddress
........
RightChild: 0xaddress
Structure 4:
LeftChild: 0xaddress
RightChild: 0xaddress
RightChild: 0xaddress
RightChild: 0xaddress
Now obviously it's quite hard to do a textual explanation of a binary tree, so hopefully my poor attempt above explains it a bit. Essentially it all starts with a structure, which has a left and right tree entries, each in turn has left and right, and eventually one of them will run out of nodes, and then the next branch of the tree carries on.
I'm not entirely sure of the best way of tackling this.
My first though was through the use of a while loop to just keep on chasing the tree nodes, but that seems like a bit of a headache to keep track of.
I know Java has binary tree implementations, but I don't know if it's possible to use them for this sort of work. I've never tried to use them, so I might be wrong.
If anyone has any advice or suggestions on how to tackle this, I'd greatly appreciate it.
Thanks!