Class SelectionSorter


public class SelectionSorter
extends ASorter
Finds the minimum od A[lo:hi], swaps it with A[lo], recur on A[lo+1:hi]. Correponds to splitting the array at the low index after putting the minimum element there, sort the two parts, and join the sorted part. The join is trivial. It's the splitting that requires some work. As such this selection sort belongs to the same family as quick sort.

Author:
Dung X. Nguyen - Copyright 1999 - all rights reserved.

Variable Index

 o Singleton

Constructor Index

 o SelectionSorter ()

Method Index

 o join (int[], int, int, int)
 o main (String[])
 o split (int[], int, int)
Finds the minimum of A[lo:hi] and swaps it with A[lo]

Variables

 o Singleton
public static final SelectionSorter Singleton

Constructors

 o SelectionSorter
private  SelectionSorter()

Methods

 o split
public int split(int[] A, int lo, int hi)
Finds the minimum of A[lo:hi] and swaps it with A[lo].

Parameters:
A -
lo -
hi -
Returns:
lo + 1, and A[lo] is the minimum of A[lo:hi].
 o join
public void join(int[] A, int lo, int s, int hi)
Parameters:
A - A[lo] is the minimum of A[lo:hi], and A[lo+1:hi] is sorted.
lo -
s - == lo + 1.
hi -
 o main
public static void main(String[] args)