**Sorting Algorithm Tutorials - Herong's Tutorial Examples** - 6.12, by Herong Yang

Java API for Sorting Algorithms

This chapter provides tutorial notes and codes on building Java API for sorting algorithms. Topics include why Java API is needed; the data element class; sorting algorithm testing program.

HyObject.java - Data Element Class

SortTest.java - Testing Program

Conclusions:

- JDK (Java Development Kit) provides a very good API for implementing sorting algorithms in Java.
- To implement sorting algorithms in Java, you should start with a data element class like HyObject.java, that implements Comparable<HyObject> interface defined in JDK.
- You should also write a test program like SortTest.java, that runs sorting implementations with random data and measures their execution performances.
- The Java implementation of "Quicksort" algorithm is faster than Java implementations of other algorithms.

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