Java API for Sorting Algorithms

This section provides performance summary of my Java implementations of different sorting algorithms using JDK 13.

The table bellow is performance summary of my Java implementations of different sorting algorithms using JDK 13. The results are recorded as milliseconds for different array sizes:

Array Size        10000   20000   30000   100000   200000   300000
----------        -----   -----   -----   ------   ------   ------
Quicksort                                     16       40       65
Merge Sort                                    14       43       84
JDK Arrays.sort                               25       66      112
Heap Sort                                     34       89      168
Sell Short                                    54      156      281
Insertion Sort       55     221     500
Selection Sort       55     250     600
Bubble Sort         284    1383    3297

As a reference, results from an older computer with an older JDK version are listed below:

Array Size        1000   2000   3000   10000   20000   30000
----------        ----   ----   ----   -----   -----   -----
JDK Arrays.sort                           17      45      70
Quicksort                                 16      40      70
Heap Sort                                 29      76     134
Sell Short                                25      81     148
Merge Sort                                69     149     241
Insertion Sort       9     34     76
Selection Sort      38    153    347
Bubble Sort         53    217    488

Source code of my Java implementations and test result details are provided in next chapters.

Table of Contents

 About This Book

 Introduction of Sorting Algorithms

Java API for Sorting Algorithms

 Why Java API Is Needed

 HyObject.java - Data Element Class

 SortTest.java - Testing Program

 java.util.Arrays.sort() - Performance

Performance Summary of Java Implementations

 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

 Performance Summary of All Implementations

 References

 Full Version in PDF/EPUB