Presentation is loading. Please wait.

Presentation is loading. Please wait.

Experimental Study on the Five Sort Algorithms You Yang, Ping Yu, Yan Gan School of Computer and Information Science Chongqing Normal University Chongqing,

Similar presentations


Presentation on theme: "Experimental Study on the Five Sort Algorithms You Yang, Ping Yu, Yan Gan School of Computer and Information Science Chongqing Normal University Chongqing,"— Presentation transcript:

1 Experimental Study on the Five Sort Algorithms You Yang, Ping Yu, Yan Gan School of Computer and Information Science Chongqing Normal University Chongqing, 400047, China CS300 – Technical Paper Review Deepak Kumar(13229)

2 Summary of the paper In computer science, sorting is an important algorithm which puts the elements of list in a particular order. It’s goal is to make records easier to search, insert and delete.

3 A. Bubble Sort Exchange two adjacent elements if they are out of order. Repeat until the array is sorted. In the best case, the input sequence is positive, the algorithm needs n-1 comparisons, and its time complexity is O(n). In the worst case, the input sequence is negative, the algorithm needs n(n-1)/2 comparisons, and its time complexity is O(n 2 ). The space complexity is O(1).

4 B. Select sort Find the smallest element in the array, and put it in the proper place. Swap it with the value in the first position. Repeat until array is sorted. The algorithm needs n(n-1)/2 comparison operations whatever the input sequence is, and its time complexity is O(n 2 ). The space complexity is O(1).

5 C. Insert Sort Scan successive elements for an out-of-order item, then insert the item in the proper place. When the input sequence is positive, the algorithm needs n-1 comparison operations without any move operations. Otherwise the algorithm needs (n+2)(n-1)/2 comparison operations and (n+4)(n-1)/2 move operation needed. Its time complexity is O(n 2 ) and space complexity is O(1).

6 D. Merge Sort Divide the list of elements in two parts, sort the two parts individually and then merge it. Its Time complexity is O(nlogn) and space complexity is O(n).

7 E. Quick Sort Partition the array into two segments. In the first segment, all elements are less than or equal to the pivot value. In the second segment, all elements are greater than or equal to the pivot value. Finally, sort the two segments recursively. In the worst case, its time complexity is O(n 2 ). Its average time complexity is O(nlogn).

8 Experiments and Results Five sort algorithms time cost under different input scale RecordsBubbleSelectInsertMergeQuick 20000.0160.0320.0160.000 40000.0630.1250.0470.0160.000 80000.2190.4840.2190.0310.000 160000.8441.9211.0160.0780.000 320003.1257.6563.2190.9060.016 6400012.00030.23514.5943.7030.016 12800048.391123.34454.79750.1250.032

9 Time cost comparison of five sort algorithms with positive input sequences

10 Conclusion AlgorithmsAverageWorstSpace BubbleO(n 2 ) O(1) SelectO(n 2 ) O(1) InsertO(n 2 ) O(1) MergeO(nlogn) O(n) QuickO(nlogn)O(n 2 )O(logn) Five sort algorithm time complexity comparison

11 THANK YOU !


Download ppt "Experimental Study on the Five Sort Algorithms You Yang, Ping Yu, Yan Gan School of Computer and Information Science Chongqing Normal University Chongqing,"

Similar presentations


Ads by Google