Consuming the LinkedList ADT

Now, it's time to consume our new LinkedList data type in our code. We can use all of the operations of the data type. We will try to initialize a new LinkedList, add several items, and then invoke the Get(), Insert(), Search(), and Remove() operations. Don't worry about invoking these operations in a specific order; as long as we have instantiated the LinkedList object, everything will work since we have restricted the out of bound index problem. Without further ado, here's the code:

// Project: Singly_Linked_List.cbp// File : main.cpp#include <iostream>#include "Node.h"#include "LinkedList.h"using namespace std;int main(){    // NULL    LinkedList<int> linkedList = LinkedList<int>();    // 43->NULL linkedList.InsertHead(43); ...

Get C++ Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.