Fill the array using random numbers

Assignment Help Data Structure & Algorithms
Reference no: EM13819681

1. Fill the array using random numbers.

srand(time(0));
for (int i = 0; i < length; i++)
list[i] = rand() % 20000;
Now copy this array two times. You need the same exact array, with the same values so you can compare sorts.

2. Execute each sort on each list(array). Example of function calls,
· bubbleSort2(list1, 5000, compBubbleSort, assignBubbleSort);
· selectionSort2(list2, 5000, compSelectionSort, assignSelectionSort);
· insertionSort2(list3, 5000, compInsertionSort, assignInsertionSort);
·
3. Use this output code. You can use different variables.
· cout << "Number of comparisons---" << endl;
· cout << " Bubble sort: " << compBubbleSort << endl;
· cout << " Selection sort: " << compSelectionSort << endl;
· cout << " Insertion sort: " << compInsertionSort << endl << endl;
·
· cout << "Number of item assignments---" << endl;
· cout << " Bubble sort: " << assignBubbleSort << endl;
· cout << " Selection sort: " << assignSelectionSort << endl;
· cout << " Insertion sort: " << assignInsertionSort << endl << endl;

Reference no: EM13819681

Questions Cloud

Why do you think workplace stress is skyrocketing : Why do you think workplace stress is skyrocketing? Do you think it is a trend that will continue? Explain the reasons for your answer. Do you think it is the responsibility of managers and organizations to help employees manage stress? Why or why ..
Questions for a fixed-rate mortgage : Part One. Please answer the following questions for a fixed-rate mortgage as a fully amortizing mortgage loan made for $175,000 at 4.5% interest for 30 years.
Delete a contact by having the user enter the name : Delete a contact by having the user enter the name
Calculate the standard deviations of the returns : Calculate the standard deviations of the returns for Goodman, Landry, and the MarketIndex.(Hint: Use the sample standard deviation formula given in the chapter, which corresponds totheSTDEV function inExcel.)
Fill the array using random numbers : Fill the array using random numbers
Commodities as alternative investments : Undertake independent research work and produce a dissertation thesis or project report and identify research methods for producing empirical data analysis, qualitative research outputs
What is the artist trying to convey : Describe the work: what is the title of the work? the size? what does it look like? what is it made out of? is hand-made? machine made? abstract or representational? it is a sculpture, installation, painting, photograph, etc? is there a relationship ..
The pros and cons of social networking : Write paper on given topic: Topic: The pros and cons of Social Networking
Which should be showing a profit seem to be losing money : Premier Products, Inc. manufactures tennis rackets. Premier Products has grown extensively over the past two years. While the company has been very profitable, President Mark Harrison is concerned with its ability to cost products accurately. Some pr..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Look scheduling policy

Given that it takes 1.75 ms to travel from one track to the next of a hard drive; that the arm is originally positioned at Track 15 moving toward the low- numbered tracks; and that you are using the LOOK scheduling policy

  C program that accepts a month and day

Make a C program that accepts a month and day for example, June 14 from the keyboard as input. Store this data in a string called date.

  Algorithm on dynamic programming-minimize amount of walking

Our goal is to plan this trip so that we minimize the maximum amount of walking done in a single day. Your algorithm should be based on dynamic programming and run efficiently.

  Write a program to find average marks

Write a program to find average marks obtained by 10 students in a test along with algorithm and write a menu driven program using function to perform following operations on 1 d array?

  Sorting algorithm to put whole array in order

Assume you have the array of 1000 records in which only few are out of order and they are not very far from their correct positions.

  Create time algorithm-minimum time required to finish task

Create the O(|V | + | E |) time algorithm which, given times ti and the dependencies, determines minimum time required to complete all the tasks.

  Construct the huffman code for the java keyword

Construct the Huffman code for the Java keyword and weights given in the following table

  Design and write the client and server programs

Each client requests multiple CPU and I/O bursts from the keyboard. This information and the private FIFO are sent to the server through a common FIFO. The server responds to each client using private FIFOs.

  Question about passing parameters

Provide an example of when passing parameters through value as opposed to passing them by reference is a better method. Provide an example of when passing parameters through reference

  Prepare the pseudo code for given algorithm

They alternate: dark, light, dark, light, and so on. You want to get all the dark disks to the right-hand end, and all the light disks to the left-hand end.

  Eliminate every other integer beginning with the integer

the Collections class which has an algorithm called rotate(List list, int distance) which can be used to rotate a list left or right. use to eliminate every other Integer beginning with the Integer in the second position. Remember that if you rem..

  Write code to implement the expression

Write code to implement the expression: A= (B+C) * (D+E) on 3-, 2-, 1- and 0- address machines. In accordance with programming language practice, computing the expression should not change the values of its operands. Show all instructions.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd