subject
Engineering, 27.12.2019 00:31 anne010p4bffk

In this assignment you are not required to write any sorting function on your own. utilize the functions provided in the header file in the assignment folder. the first part of this assignment will take 2-10 hours depending on your implementation.

in group assignment 2 we examined the bubble sort, selection sort, insertion sort, quick sort, and merge sort functions and compared the time taken for each function to sort 1000- 300,000 random variables. in this assignment we will examine how long these functions (except bubble sort) take to sort 1000 – 150,000 values in increments of 1000 (1000,2000,3000,4000…5). unlike assignment 2 a doubly linked list will be used to store the values however a number of the sorting functions utilize a singly linked list implementation of the algorithm. two versions of the selection sorting algorithm will be used; the data swapping version and the node swapping version of the algorithm. for the other two sorting algorithms a node swapping version will be used.

a header file containing all the required sorting functions (selection sort node, selection sort data swap, insertion sort node, and quick sort node), node structure and node functions has been provided for you.

1. create an integer variable named ‘listsize’ and initialize the value to 1000.

2. open an output file named ‘groupassignment4results. csv’. the first line of this file should be the column headings: ‘list size’, ‘selection sort data swap time’, ‘selection sort node swap time’, ’insertion sort node swap time’, ‘quick sort node swap time’.

3. using the rand () function, fill 4 doubly linked list of integers with the number of variables corresponding to the ‘listsize’ variable. the list should be created using the push operator. the values generated by rand () should be numbers from 1-500,000. the list should be named; selectionlistdata, selectionlistnode, insertionlistnode, and quicklistnode.

4. you should use the: a. selection sort data swap function to sort the selectionlistdata b. selection sort link swap function to sort the selectionlistnode c. insertion sort link swap function to sort the insertionlistnode d. quick sort link swap function to sort the quicklistnode the list size and the time taken to sort each list should be outputted to the previously opened csv file with the time taken for each sorting function placed in the appropriate column.

5. you should then delete all 4 list and increase the size variable by 1000.

6. repeat steps 2-6 until ‘listsize’ is 150,000 (this should be done using a for loop or while loop). 7. utilizing the results from your csv file create line graphs for each function individually and a graph with all the results on a single graph. the size of the list should be placed on the x-axis and the time taken on the y axis.

8. combine the results from your csv file with the results from the group assignment 2 csv file into a single file and create line graphs for each function individually and a graph with all the results on a single graph. the size of the list should be placed on the x-axis and the time taken on the y axis.

the output should be written to a file via file streaming from within the program itself. the unsorted and sorted list should not be written to a file or the screen in your final submission. hand in the source code (header file and main program) and output (csv file) as well as your spss, excel or tableau generated graphs (word document, excel file, or pdf).

data

demo program demonstrating the sorting function. cpp

#include

#include "doublylinkedlist. h"

using namespace std;

int main()

{

int catchvar; //to hold values exiting the queue

//create a dynintqueue object

doublylinkedlist list;

std: : cout < < std: : boolalpha;

list. push(6);

list. push(4);

list. push(6);

list. push(10);

list. push(12);

list. push(31);

list. quicksort();

list. displaylist();

list. removeallnode();

list. displaylist();

list. push(6);

list. push(4);

list. push(6);

list. push(10);

list. push(12);

list. push(31);

list. selectionsortdata();

list. displaylist();

list. removeallnode();

list. displaylist();

list. push(6);

list. push(4);

list. push(6);

list. push(10);

list. push(12);

list. push(31);

list. selectionsortnode();

list. displaylist();

list. removeallnode();

list. displaylist();

list. push(6);

list. push(4);

list. push(6);

list. push(10);

list. push(12);

list. push(31);

list. insertionsortnode();

list. displaylist();

list. removeallnode();

list. displaylist();

return 0;

}

ansver
Answers: 1

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Refrigerant 134a enters an insulated compressor operating at steady state as saturated vapor at -26°c with a volumetric flow rate of 0.18 m3/s. refrigerant exits at 9 bar, 70°c. changes in kinetic and potential energy from inlet to exit can be ignored. determine the volumetric flow rate at the exit, in m3/s, and the compressor power, in kw.
Answers: 1
question
Engineering, 04.07.2019 18:10
Aplate clutch has a single pair of mating friction surfaces 250-mm od by 175-mm id. the mean value of the coefficient of friction is 0.30, and the actuating force is 4 kn. a) find the maximum pressure and the torque capacity using the uniform-wear model. b) find the maximum pressure and the torque capacity using the uniform-pressure model.
Answers: 3
question
Engineering, 04.07.2019 18:10
At 12 noon, the count in a bacteria culture was 400; at 4: 00 pm the count was 1200 let p(t) denote the bacteria cou population growth law. find: (a) an expression for the bacteria count at any time t (b) the bacteria count at 10 am. (c) the time required for the bacteria count to reach 1800.
Answers: 1
question
Engineering, 04.07.2019 19:10
Asteam is contained in a rigid tank with a volume of 1 m3. initially, the pressure and temperature are 7 bar and 500 oc, respectively. the temperature drops due to cooling process. determine: (1) the temperature at which condensation begins in °c, (2) the fraction of the total mass that has condensed when the pressure decreased to 0.5 bar. (3) the volume in m3 occupied by saturated liquid at the final state?
Answers: 3
You know the right answer?
In this assignment you are not required to write any sorting function on your own. utilize the func...
Questions
question
Mathematics, 20.09.2020 05:01
question
Mathematics, 20.09.2020 05:01
question
Mathematics, 20.09.2020 05:01
Questions on the website: 13722362