Question
C++ 2) Write an OOP program to store integers into a two way linked list. ( Note: Internet research - search for an example of
C++
2) Write an OOP program to store integers into a two way linked list.
( Note: Internet research - search for an example of a two way linked list, and Insertion sort )
* Create a UML class diagram...
Add code so that the linked list is sorted ( May not be necessary - depends on how you insert a value )
Add a function so you can search for an integer
Have a function to ask the user for input.
Add a function to delete an integer
Have the ability to know/printout the count of the number of integers in the list ( Hint: Keep a count variable )
Have a function to print out the list
Test:
* Enter 23,42,75, 104, 32, 21, 11, 49 in this order...
* Sort elements in array ?? Did you use insertion sort - so a separate sort function is NOT necessary.
( Hint: This may not be necessary, it you write an Enter value Insertion function that places the value in the right position, so it is ordered )
* Find value 42
* Try to find value 91
* Delete 32 and ( No re-sort should not be necessary since it is a linked list - depends on how you code the delete function ! )
* Print all element in list
Note: The int main() function contents should be exactly the same as program 1.
filename: week5YourNameProg1sortFindlinkedList
---------------------------
Hint: Here is most of the code for the int main() function for BOTH prog 1 and prog 2.
Example of int main() {
className List; // use class definition and declare instance.
List.Insert(23);
List.Insert(42);
List.Insert(75);
List.Insert(104);
List.Insert(32);
List.Insert(21);
List.Insert(11);
List.Insert(49);
List.Sort(); // required in prog 1. Should not be needed in prog 2 if you do insertion sort properly.
List.PrintAll();
cout << List.Find(42) << endl;
cout << List.Find(91) << endl;
List.Delete(32);
List.Sort(); // required in prog 1. Should not be needed in prog 2 if you do insertion sort properly.
List.PrintAll();
return 0;
}
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