Question: Extend the class linkedListType by adding the following operations: Find and delete the node with the smallest info in the list. (Delete only the first
Extend the class linkedListType by adding the following operations:
Find and delete the node with the smallest info in the list. (Delete only the first occurrence and traverse the list only once.)
Find and delete all occurrences of a given info from the list. (Traverse the list only once.). For example, if the original list looks like this: 1, 2, 3, 4, 2, 5, 2 the revised list should look like this after deleting all occurrences of nodes with 2 in the info field: 1, 3, 4, 5
Add these as abstract functions in the class linkedListType and provide the definitions of these functions in the class unorderedLinkedList. Also, write a program to test these functions. Make the modifications to the template files linkedList.h and unorderedLinkedList.h which can be found in Chapter 16/Source Files on the Blackboard.
Turn in your modified template files, your test program, and one or more screen shots of the results of your testing.
After completing this assignment you will show that you can
Extend a class by adding new operations.
Add operations to the base class as abstract functions and implement them in a derived class.
Construct functions to delete nodes that account for all possible linked list configurations.
Construct functions to delete nodes that do not violate the class invariant.
Construct functions to delete nodes that do not introduce a memory leak.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
