Question: Problems: Write a program in C++ that implements the linkedListType class given in the following UML diagram. Further, derive the unorderedLinkedList class from the linkedListType

Problems:

  1. Write a program in C++ that implements the linkedListType class given in the following UML diagram. Further, derive the unorderedLinkedList class from the linkedListType thereby providing the implementation of the pure virtual functions given in the UML diagram.

Problems: Write a program in C++ that implements the linkedListType class given

2- Add the following abstract functions to the class linkedListType and provide the definitions of these functions in the class unorderedLinkedList. Also write a program to test these functions.

  1. Find and delete the node with the smallest info in the list. Delete only the first occurrence and traverse the list only once.

virtual void deleteSmallest() = 0;

  1. Find and delete all occurrences of a given info from the list. Traverse the list only once.

virtual void deleteAll(const int& deleteItem) = 0;

Sample Input/Output:

in the following UML diagram. Further, derive the unorderedLinkedList class from the

linkedList Type linkedListType -count: int - *first: node Type -*last: ngde Type +isEmptyList() const: bool +print () const: void +length() const: int +destroyList(): void +search (const Type&) const = 0; bool +insertFirst (const Type&) = 0: void +insertLast (const Type&) = 0: void +deleteNode (const Type&) = 0: void unorderedLinkedList +linkedListType() +-linkedListType() Enter numbers ending with -999 25 20 40 50 20 95 20 10 66 75 -999 List: 25 20 40 50 20 95 20 10 66 75 Length of the list: 10 Enter the number to delete all its occurrences: 20 List after deleting all occurrences of 20 25 40 50 95 10 66 75 Length of the list: 7 List after deleting the first smallest element 25 40 50 95 66 75 Length of the list: 6 linkedList Type linkedListType -count: int - *first: node Type -*last: ngde Type +isEmptyList() const: bool +print () const: void +length() const: int +destroyList(): void +search (const Type&) const = 0; bool +insertFirst (const Type&) = 0: void +insertLast (const Type&) = 0: void +deleteNode (const Type&) = 0: void unorderedLinkedList +linkedListType() +-linkedListType() Enter numbers ending with -999 25 20 40 50 20 95 20 10 66 75 -999 List: 25 20 40 50 20 95 20 10 66 75 Length of the list: 10 Enter the number to delete all its occurrences: 20 List after deleting all occurrences of 20 25 40 50 95 10 66 75 Length of the list: 7 List after deleting the first smallest element 25 40 50 95 66 75 Length of the list: 6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!