-
Book Overview & Buying
-
Table Of Contents
C++ Data Structures and Algorithm Design Principles
By :
As we discussed in the previous section, a tree is nothing but some objects or nodes connected to other nodes via a relationship that results in some sort of hierarchy. If we were to show this hierarchy in a graphical way, it would look like a tree, while the different edges would look like its branches. The main node, which is not dependent on any other node, is also known as a root node and is usually represented at the top. So, unlike an actual tree, this tree is upside down, with the root at its top!
Let's try to construct a structure for a very basic version of an organizational hierarchy.
In this exercise, we will implement a basic version of the organizational tree we saw in the introduction to this chapter. Let's get started:
#include <iostream>
#include <queue>
Change the font size
Change margin width
Change background colour