Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CISC 225 Advanced Programming Techniques Assignment 5 Write a program that fills an array of integers. Ask the user for the value that represents the

CISC 225 Advanced Programming Techniques

Assignment 5

Write a program that fills an array of integers. Ask the user for the value that represents the number of elements in the array (n). Use the random number generator in a loop that runs n times to fill the loop with int values between 1 and 1000.

The purpose of your program will be to count the number of operations required to sort the array using the following sorting methods:

Insertion sort

Selection sort

Bubble sort

Since we will sort the array using three different methods, we should make sure that we are comparing apples to apples. This means that we should sort the same values with each algorithm. To do this, create three new arrays that are the same size as the original and copy the int values from the original to each of the new arrays.

Print the results for each of the sorting methods to compare the number of operations and check for efficiency. To get a better feel for the efficiency of the algorithms, pause before the first sort to tell the user that the first sort is about to begin. Do the same at the end of the sort to show the user the results.

You can use the code provided in class for each sort method.

Run your program several times for changing values of n.

Question

At what value of n do you notice a difference?

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_2

Step: 3

blur-text-image_3

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

Students also viewed these Databases questions