Question: you are to write a program that implements eleven sorting algorithms as well as call the built-in one from any programming language. Native Sort (not

you are to write a program that implements eleven sorting algorithms as well as call the built-in one from any programming language.

  • Native Sort (not the name of a sorting algorithm, rather your language's built-in sort, Tim Sort if youre using python )

  • Bubble Sort

  • Selection Sort

  • Insertion Sort

  • Cocktail Sort

  • Shell Sort

  • Merge Sort

  • Quick Sort

  • Heap Sort

  • Counting Sort

  • Bucket Sort

  • Radix Sort

Assignment-Specific Tasks:

[1] Write a function random_list(range_max, size) that returns a list of size random numbers in range(1, range_max).

[2] After generating the random list, you will need to make a copy of it for each algorithm. (Otherwise, once you sort it for one algorithm, it is already sorted!!!)

[3] Write or call a function that will confirm that the list has been sorted. If it detects an error, make sure to print it very conspicuously (or throw an exception) so that the error can be researched.

[4] For each of the 11+1 aforementioned sorting algorithms, write a function that implements it. You can copy the code from an online source, just acknowledge it. Keep the signatures consistent (same arguments in the same positions) so they can all be called in the same fashion as shown in class..

[5] In your main function, iterate over all the sorts for the same list size. Capture the time before and after so you can track the elapsed time for the sorting algorithm. [Repeat these runs multiple times for the same size and find their average time.]

[6] Repeat these runs for lists of different sizes: n = 10, 100, 1000, 10000

[7] Summarize the results in a table. Place the sorting algorithms along the left side and the different sizes across the top.

[8] Visualize the statistics in a graph using matplotlib or another graphic package. Place all sorts in the same graph for easy comparison. Use a different color for each sort and create a color legend either in or below the graph.

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 Databases Questions!