The node is the basic building block of many data structures which we will discuss in this book. Node has two functions. Its first function is that it holds a piece of data, also known as the Value of node. The second function is its connectivity between another node and itself, using an object reference pointer, also known as the Next pointer. Based on this explanation, we can create a Node data type in C++, as follows:
class Node{public: int Value; Node * Next;};
We will also use the following diagram to represent a single node:
Now, let's create three single nodes using our new Node data type. The nodes will contain ...