Search Menu


Implementing Tree

When we say a tree, we are talking about a way to structure data. The term tree on its own does not necessarily indicate one specific way of implementing this structure. Instead it just says that however we implement it, our implementation must allow for the data to be thought of in the general way that a tree structures data, as described in Section I.

This means that it will be up to you to decide exactly how to implement your trees using C Code. What all this means is that you will need to define some type in your code for a tree, of which you can then make variables. We will discuss a few very different approaches, such as one that uses structs and pointers and another that simply uses an ordinary array. The first of these two ways is the more generally used technique; the second is included more as an exercise in seeing how to use one data structure, the array, to implement a radically different structure, the tree.