Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program language is c++ MOVIES CLASS Create the functions described below. All of the following functions except for algorithmEfficiency() should be made private. o

The program language is c++

MOVIES CLASS Create the functions described below. All of the following functions except for algorithmEfficiency() should be made private. o linearSearch This function should search for a particular movie title to see if it is in the list. It should return -1 if the Movie title could not be found. Use the linear search algorithm to implement this function. o binarySearch - This function should search for a particular movie title to see if it is in the list. It should return -1 if the Movie title could not be found. Use the binary search algorithm to implement this function. o bubbleSort 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 bubble sort algorithm to implement this function. o insertionSort - 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 insertion sort algorithm to implement this function. 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 & merge These two functions work together to implement the merge sort algorithm, which should sort the LinkedList 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 point 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.

quickSort & partition These two functions work together to implement the quick sort algorithm, which should sort the LinkedList 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 pivot string (c-string). The partition function will call a function called swap in the linkedList class to swap values in the linked list when necessary. o 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: 1. Start timer Call linearSearch sending a temporary Text* with a c-string named Llama to it. (I dont care if It finds this string or not) Stop timer Print out total time for this algorithm 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 order. 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 selectionSort() Stop timer Print out total time for this algorithm 5. Call insertionSortDescending() to put linked list in opposite order. Start timer Call insertionSort() Stop timer Print out total time for this algorithm 6. Start timer Call insertionSortDescending() Stop timer Print out total time for this algorithm 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 algorithm

8. Start timer Call quickSort() sending 0 and the length of the linked list (# of nodes) minus 1 to the function Stop timer Print out total time for this algorithm LINKEDLIST CLASS Add a function to the LinkedList template class (LinkedList.h) called swap. This function should accept two integers which represent two node positions that need to be swapped. This function should swap the VALUES in the two nodes. You do not have to swap the whole node, just swap the values.

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

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions