Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Core Ios Developer S Cookbook Core Recipes For Programmers

Authors: Erica Sadun ,Rich Wardwell

5th Edition

0321948106, 978-0321948106

More Books

Students also viewed these Programming questions

Question

1.1 What is the purpose of producing accounting information?

Answered: 1 week ago