GitHub Viewer
/**
* Book: Data Structures and Algorithms in Java, by Robert LaFore
* Chapter 3:
* selectSort.java
* demonstrates selection sort
* to compile this code: javac selectSort.java
* to run this program: java SelectSortApp
*/
class ArraySel {
private long[] a; // ref to array a
private int nElems; // number of data items
public ArraySel(int max) { // constructor
a = new long[max]; // create the array
nElems = 0; // no items yet
}
public void insert(long value) { // put element into array
a[nElems] = value; // insert it
nElems++; // increment size
}
public void display() { // displays array contents
for (int j=0; j