Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ MOVIES CLAS5 You should already have an insertionsort) and binarysearch) function in this program (written for program 6) .Modify the add movle functions &
C++
MOVIES CLAS5 You should already have an insertionsort) and binarysearch) function in this program (written for program 6) .Modify the add movle functions & edit movie function so that they no longer sort or search (which means duplicate movie titles will be allowed) If you do not do this then your program will take a long, long, long time to do testing. You wlill create 9 new functions, All of the following functions except for algorithmEfficlency) should be made private. ?linearSearch-This function should search for particular movie title to see if it is in the list. It should return-1 if the Movie title could not be found. Renember that Movie titles are of data type Text. Use the linear search algarithrn to implement this function. o bubbleSort This function should sort the UnkedList of Movies in ascending order by Movie title. This function will call a function calle algorithm to implement this function. d swap in the linkedList class to swap values in the linked list when necessary. Use the bubble sort o insertionSortDescending This function should be the same as insertionSort except it will sort the LinkedList of Movies in descending order by Movie title instead of ascending order o selectionsort- This function should sort the LinkedList of Movies in ascending order by Movie title. This function will call a function called swap in the linkedList class to swap values in the linked list when necessary. Use the selection sort algorithm to implement this function. o mergeSort & erge These two functions work together to implement the merge sort alporithm, which should sart the UnkedList of Movies In ascending order by Movie title. The mergesort function is a recursive function which calls the merge function. The merge function dynamically allocates a new linked list of Movie pointers to use as the merged linked list. At some polnt in the merge function you will need to replace a node...you will do this by deleting the node (deleteNode) at a particular position and then inserting a new node (insertNode function) at a particular position. o quickSort & partition These two furictions work together to inplement the quick sort algorithrn, which should sart the Unkedist of Movies in ascending order by Movie title. The quicksort function is a recursive function which calls the partition function. The partition function will use a plvot string (c-string). The partition function will call a function called s wap In the linked List class to swap values In the linked list when necessary, algorithmAnalysis- This is the "driver" function that will call all of these other functions to test the efficiency of each one. Here is the pseudocode for this function below: o 1. Start timer Call linearsearch sending a temporary Text string or not) Stop timer Print out total time for this algorithm with a c-string named "Llama" to it. don't care if It finds this 2. Start timer Call binarySearch sending a temporary Text with a c-string named Llama" to it Stop timer Print out total time for this algorithm 3. Call insertionsortDescending() to put linked list in opposite orden Start timer Call bubbleSort) Stop timer Print out total time for this algorithm 4. Call InsertionSortDescending) to put linked list In opposite order Start timer Call selectionSart) Stop timer Print out total time for this algorithm 5. Call InsertionSortDescending) to putlinked list in opposite order Start timer Call insertionSort) Stop timer Print out total time for this algorithm 6. Start timer Stop timer Print out total time for this algorithn 7. Start timer Call mergesort() sending 0 and the length of the linked list (# of nodes) minus 1 to the function Stop timer Print out total time for this algorlthm 8. Start time Call quickSortl) sending 0 and the length of the linked list (# of nodes) minus 1 to the functionStep 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