Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need four programs: 1. Write a computer program that prompts the user for a number, creates an array for that number of random integers,

I need four programs:

1. Write a computer program that prompts the user for a number, creates an array for that number of random integers, and then uses the bubble sort to order the array. The program should print out the array prior to the call to the sorting algorithm and afterward. You can write the program in C#.

2. repeat 1 but use selection sort

3. Write a computer program that prompts the user for two numbers, n for the number of items in the array to sort, and num_i for a number of iterations. Then do the following: In the body of the loop,

- Create an array of n random integers

- Get the time and set this to start-time. You will have to figure out what the appropriate command is in the programming language you are using to find end time

- Use bubble sort to sort the array

- Get the time and set this to end-time - Subtract end-time from start-time and add the result to running_time Once the program has run, note that the output of your program should include:

- The number of items sorted

- The number of iterations

- The running time for each size array

Repeat the process nine times, using 50, 250 and 500 as the size of the array, and 100, 1000 and 10,000 as the number of iterations.

4. Repeat 3 using selection sort.

In totality, the answer should contain 4 program codes.

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

Recommended Textbook for

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions