Each team works on assigned sorting algorithms and will give
Each team works on assigned sorting algorithms and will give demonstration and PowerPoint presentation on Nov, 16th during lab class. Search internet for tutorials and source code in python on sorting algorithms assigned to your team. Modify the python code to count the number of comparisons and the number of swaps when sorting a random list of size n, n = 100, for example, n = 100, 1000, 10000. To test your program use a small size of n for example, n = 10, and print the list before and after sorting. Once confirmed the your program sorts correctly, try larger size of n without print the list. In your presentation, explain how do the sorting algorithms work and given their worst case and average case complexity, and include following table: Submit the source code and presentation to D2L Assignment for Team Project 1 before 11:00PM. 11/16/2016. Sorting Algorithms: Selection sort, quick sort Insertion sort, shell sort Bubble sort, merge sort Heap sort Radix sort
Solution
Sorting Algorithm N=100 N=1000 N=10000 Selection #Comparisions sum from 1 to100 sum from 1 to1000 sum from 1 to1000 #swaps 100 1000 10000 Insertion #Comparisions sum from 1 to100 sum from 1 to1000 sum from 1 to10000 #swaps 100 1000 10000 Merge #Comparisions sum from 1 to100 sum from 1 to1000 sum from 1 to10000 #swaps 100 1000 10000 Quick #Comparisions sum from 1 to100 sum from 1 to1000 sum from 1 to10000 #swaps 2*(sum from 1 to100) 2*(sum from 1 to1000) 2*(sum from 1 to10000) Bubble #Comparisions 100*100 1000*1000 10000*10000 #swaps 100*100 1000*1000 10000*10000