Search Menu


A Tree Manipulation Library

Whenever you implement a new data type, it is usually a good idea to provide functions for manipulating it. There is a general concept in computer science referred to as the black box principle. It is the idea that the user of a data type should not need to be aware of how it is implemented because a library of functions is provided to interact with. This library separates the user from the implementation. This is a good idea because it allows you the programmer to change the implementation (and not the interface) at any point without the user of the data type having to worry about the change affecting his code. This concept is a central idea in Object-Oriented programming.

In the following SparkNote Topic, we will present some of the central functions that should be part of this library. The idea would then be to implement all of the functions together in the same .c file with their prototypes all in the same header file which the file using the tree data type should #include. For this particular implementation, we will use the tree node described in Section 1 of Topic I, which made use of structs and pointers.