Sorting Algorithm Tutorials - Herong's Tutorial Examples - 6.12, by Herong Yang
Performance Summary of All Implementations
This chapter provides a performance summary of my implementations of different sorting algorithms in different languages: Java, PHP, Perl, and Python.
The table below provides a performance summary of my implementations of different sorting algorithms in different languages:
Array Size: 10000 20000 30000 100000 200000 300000
----- ----- ----- ------ ------ ------
Python sort() 1 1 2 7 14 21
Java Quicksort 16 40 65
Java Merge Sort 14 43 84
Java Arrays.sort 25 66 112
Java Heap Sort 34 89 168
Java Sell Short 54 156 281
PHP sort() 3 7 13 75
Perl sort() 11 22 36 171
Perl Quicksort 20 46 75
PHP Quicksort 20 42 76
PHP Merge Sort 28 60 93
Perl Merge Sort 48 100 153
PHP Heap Sort 47 100 160
PHP Shell Sort 40 106 177
Python Quicksort 63 137 231
Python Merge Sort 91 180 294
Perl Heap Sort 92 200 315
Perl Shell Sort 99 227 377
Python Shell Sort 117 275 432
Java Insertion Sort 55 221 500
Python Heap Sort 151 324 514
Java Selection Sort 55 250 600
Java Bubble Sort 284 1383 3297
PHP Insertion Sort 2213 9484 23329
PHP Selection Sort 3580 14129 33808
Perl Insertion Sort 4125 16015 37098
Python Insertion Sort 4983 20592 46652
PHP Bubble Sort 6847 28427 66524
Perl Selection Sort 8054 31249 68985
Python Selection Sort 18307 74122 168144
Perl Bubble Sort 19344 78360 177353
Python Bubble Sort 28109 115418 260671
What can we learn from this table:
Table of Contents
Introduction of Sorting Algorithms
Java API for Sorting Algorithms
Insertion Sort Algorithm and Java Implementation
Selection Sort Algorithm and Java Implementation
Bubble Sort Algorithm and Java Implementation
Quicksort Algorithm and Java Implementation
Merge Sort Algorithm and Java Implementation
Heap Sort Algorithm and Java Implementation
Shell Sort Algorithm and Java Implementation
Sorting Algorithms Implementations in PHP
Sorting Algorithms Implementations in Perl
Sorting Algorithms Implementations in Python