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
Adouble-strand no. 60 roller chain is used to transmit power between a 13-tooth driving sprocket rotating at 300 rev/min and a 52-tooth driven sprocket. a) what is the allowable horsepower of this drive? b) estimate the center-to-center distance if the chain length is 82 pitches. c) estimate the torque and bending force on the driving shaft by the chain if the actual horsepower transmitted is 30 percent less than the corrected (allowable) power.
Answers: 3
question
Engineering, 04.07.2019 18:20
Acertain flow of air (at stp) has a velocity distribution given by v i (in ft/s). if this flow is going through a 4 ft square area in the yz-plane (centered at the origin), what is the mass flow rate (in lbm/s)?
Answers: 2
question
Engineering, 04.07.2019 19:10
10 kg of co2 is initially contained at 400 kpa and 300 k. the gas constant for carbon dioxide is 189 j/lkg k) and has a specific heat ratio, k, of 1.289. isentropic expansion then occurs until the pressure is 200 kpa. a) determine the initial volume of co2 in m. b) determine the final temperature in k. c) determine the work done by the system during the expansion kl.
Answers: 2
question
Engineering, 04.07.2019 19:10
Starting wih an energy balance on a rectangular volume element, derive the one- dimensional transient heat conduction equation for a plane wall with constant thermal conductivity and no heat generation.
Answers: 1
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, 10.12.2021 20:40
question
Mathematics, 10.12.2021 20:40
question
Mathematics, 10.12.2021 20:40
question
Mathematics, 10.12.2021 20:40
question
Spanish, 10.12.2021 20:40
question
Mathematics, 10.12.2021 20:40
Questions on the website: 13722363