|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.data.SelectionSort
public class SelectionSort
A generic selection sort. Based on chapter 9 of Algorithms, by Robert
Sedgewick, 1988 ISBN 0-201-06673-4. Uses pluggable SortingGophers to
allow sorting of any list of data.
This isn't declared as a singleton, since it has no actual overhead (no
state), so there's not strong reason to limit instantiation. However an
standardInstance() method is provided that provides a shared
instance.
You can also just use this via the handy convenience method
SortingLib.selectionSort(SortingGopher); that is actually the
recommended method.
Copyright 2000-2006 Partner Software, Inc.
| Constructor Summary | |
|---|---|
SelectionSort()
Creates a new SelectionSort algorithm object. |
|
| Method Summary | |
|---|---|
void |
sort(SortingGopher gopher)
Sorts using the given SortingGopher. |
void |
sort(SortingGopher gopher,
int start,
int end)
Sorts using the given SortingGopher over the given range (start <=
i < end). |
static SelectionSort |
standardInstance()
Returns a singleton shared instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SelectionSort()
standardInstance() method.
| Method Detail |
|---|
public static SelectionSort standardInstance()
public final void sort(SortingGopher gopher)
SortingAlgorithmSortingGopher.
sort in interface SortingAlgorithmgopher - SortingGopher adapter for underlying array-like structure.
public final void sort(SortingGopher gopher,
int start,
int end)
SortingAlgorithmSortingGopher over the given range (start <=
i < end).
sort in interface SortingAlgorithmgopher - SortingGopher adapter for underlying array-like structure.start - starting index (0 is minimum) for sort region (inclusive)end - ending index for sort region (exclusive)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||