Question
In C++ Write and demonstrate the following functions using LinkedList template class. These functions are not member functions of the class; you will write these
In C++
Write and demonstrate the following functions using LinkedList template class. These functions are not member functions of the class; you will write these functions in functions.cpp with main:
function1: receives two LinkedList objects. The function merges the sorted lists into a new list then returns the new list object back to main. Display the returned list.
function2: receives two LinkedList objects and compares the data in the nodes of the two lists to check if they are the same. The lists are considered equal if they have the same exact number of nodes and corresponding nodes contain the same data. The function returns true or false to main.
Hint: T getValueAt(int) function will be very helpful. Another option is to use deleteLast(), deleteFront(), insertFront(T value), and insertEnd(T value) functions.
LinkedList class must contain all the following functions:
LinkedList() // Constructor
~LinkedList(); // Destructor
void appendNode(T);
void insertNode(T);
void deleteNode(T);
void displayList();
int search(T); // search function
T getTotal();
int numNodes();
T getValueAt(int);
T getAverage();
T getLargest();
int getLargestPosition();
T getSmallest();
int getSmallestPosition();
T deleteLast();
T deleteFront();
void insertFront(T value);
void insertEnd(T value);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started