Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Practical Introduction To Data Structures And Algorithm Analysis Java Edition

Authors: Clifford A. Shaffer

1st Edition

0136609112, 978-0136609117

More Books

Students also viewed these Programming questions

Question

How do people develop skills?

Answered: 1 week ago