Question: Implement the following algorithms in Java or Python: 1 . 1 . Selection sort 1 . 2 . Insertion sort 1 . 3 . Merge

 

Implement the following algorithms in Java or Python:

1.1. Selection sort

1.2. Insertion sort

1.3. Merge sort

1.4. Quick sort

1.5. Heap sort

2. (5 points) State their worst-case time efficiency using the Big-\theta notation.

3. (5 points - 1 point each) Generate random sample inputs (of integer numbers between 100 and

100) of the following sizes:

3.1. 10 000

3.2. 20 000

3.3. 40 000

3.4. 80 000

3.5. 160 000

4. (10 points) Test the 5 sorting algorithms on the five input sizes and record the running time (in

seconds).

5. (5 points) Repeat steps 3 and 4 five times and record the average values of each sorting

algorithm. Do we need this step? Justify your answer.

6. (10 points) Report the results in a table. Discuss and analyze them.

7. (10 points) Compute the ratio t(2n)/t(n), where t is the running time of an algorithm and n is the

input size, for each sorting algorithm and compare it to its corresponding time efficiency. Does it

match? Explain.

8. (10 points) Use scatter plots (as in Chapter 2, p. 89 of our textbook) to help in ascertaining the

algorithms probable efficiency class. Discuss the plots.

 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!