Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that creates an array of 100 elements that are populated by random numbers between 0 and 999 (hint: you can reuse

Write a C++ program that creates an array of 100 elements that are populated by random numbers between 0 and 999 (hint: you can reuse a lot of code from the first problem!) Run the ascending sort algorithm on it use the one demonstrated in class (and found on our website under the demos section). Measure how long it took to run the sort. To make such a measure, use a Linux OS tool called time that measures how long a program takes to execute. To use time, do the following: step a. Compile your program. Let us assume that the executable (object) file is called Prob3. step b. At the Linux prompt (%), type: time ./Prob3 and hit return. step c. The program will be executed and, at the bottom, you will see a print out of 3 lines showing execution times (use the first entry real for this homework). Now modify the program so that the array size is 1,000 elements and rerun the sort algorithm. Again, measure how long it took to run the sort was it noticeably longer? If so, by what (approximate) factor? One more time, modify the program for an array size of 10,000 elements, rerun and time the sort and answer the same questions.

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

Students also viewed these Databases questions