Answered step by step
Verified Expert Solution
Link Copied!

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++

image text in transcribed

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 function

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

Step: 3

blur-text-image

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

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

3642412203, 978-3642412202

More Books

Students also viewed these Databases questions

Question

Is there a clear hierarchy of points in my outline?

Answered: 1 week ago