teach-ict.com logo

THE education site for computer science and ICT

3. Node details

Now that we have the terminology, it's time to look in more detail in how a tree is put together.

Each node in a tree contains a chunk of data, called a payload. In addition to the payload, each node holds several pointers. These pointers are memory addresses for the nodes it is connected to. A node will have a pointer for its parent node, and a pointer for each of its child nodes. Look at the diagram below:

The node B would have a pointer for A, D, and E. It would not have a pointer for C or F, as they are not directly connected to it. It would look like this:

 

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: parts of a tree structure