Building a Singly Linked List ADT
The Singly Linked List (also known as the linked list) is a sequence of items linked with each other. It's actually a chaining of nodes, where each node contains the item's value and the next pointer. In other words, each item in the linked list has a link to its next item in the sequence. The thing that differs between the linked list and the node chain is that the linked list has a Head
and a Tail
pointer. The Head
informs the first item and the Tail
informs the last item in the linked list. Similar to the List ADT, we discussed earlier, the linked list has Get()
, Insert()
, Search()
, and Remove()
operations, where all of the operations have the same functionality compared to List
. However, since we now have Head
and Tail
pointers, we will also create others operations, and these are InsertHead()
, InsertTail()
, RemoveHead()
, and RemoveTail()
. The declaration of the LinkedList
class should be as follows:
template <typename T> class LinkedList { private...