Menu

[solved]-Need C Language Lab Need Write C Program Excel File Need Submit Code Excel File Webcourses Q39011385

NEED THIS IN C LANGUAGE

In this lab you will need to write a c program and an excelfile. You will need to submit both your

code and the excel file in the webcourses.

Experimental Study of the Execution Times of the SortingAlgorithms

In this lab,

you will perform experimental study on the sorting algorithms wehave learned so far.

You are asked to compare execution time of the following sortingalgorithms:

selection sort, bubble sort, insertion sort, merge sort

, and quick sort

All of these algorithm source codes in c are available in yourmain course webcourses.

So, copy

them as you need.

In order to do the

comparison, you will need to

:

1)

Create an array and fill it with random numbers

2)

Pass this array to each sorting algorithms

3)

Write down the execution time for each algorithm in an excelfile

and plot them to see

how the execution time changes with time.

A good idea could be creating an array containing the totalnumber of data you want to produce

at each phase. For example, A

sizes array with total number of elements for each testcases

[1000, 10000, 20000, 40000, 50000, 100000]

can be useful to generate 1000 number, 10K

number, and so on.

You may find the following hints useful:

1)

To generate random numbers between [1,

maxVal

] you can use the rand function:

n =

rand()

%

maxVal

+ 1;

Just put this line in your for loop and store n in thearray.

2)

To calculate the execution time you can use the followingtechnique

:

int start = time(0);

bubbleSort(sortedArray, sizes[i]);

int end = time(0);

printf(“Sorting %d values took %d seconds for Bubble sort.

n”, sizes[i], end

-start);

Expert Answer


Answer to NEED THIS IN C LANGUAGE In this lab you will need to write a c program and an excel file. You will need to submit both y… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *