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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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