Opus5
Class BucketSorter

java.lang.Object
  |
  +--Opus5.AbstractSorter
        |
        +--Opus5.BucketSorter
All Implemented Interfaces:
Sorter

public class BucketSorter
extends AbstractSorter

Sorter for sorting an array of Ints. Implements bucket sort.

Version:
$Id: BucketSorter.java,v 3.2 1998/07/28 12:02:38 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.
See Also:
Int

Field Summary
protected  int[] count
          The counters (buckets).
protected  int m
          The number of counters (buckets).
 
Fields inherited from class Opus5.AbstractSorter
array, n
 
Fields inherited from interface Opus5.Sorter
copyright
 
Constructor Summary
BucketSorter(int m)
          Constructs a BucketSorter with the specified number of buckets.
 
Method Summary
protected  void sort()
          Sorts the array of comparable objects.
protected  void sort(Int[] array)
          Sorts the specified array.
 
Methods inherited from class Opus5.AbstractSorter
sort, swap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m

protected int m
The number of counters (buckets).

count

protected int[] count
The counters (buckets).
Constructor Detail

BucketSorter

public BucketSorter(int m)
Constructs a BucketSorter with the specified number of buckets.
Parameters:
m - The desired number of buckets.
Method Detail

sort

protected void sort()
Sorts the array of comparable objects. The array is assumed to be an array of Ints.
Overrides:
sort in class AbstractSorter

sort

protected void sort(Int[] array)
Sorts the specified array.
Parameters:
array - The array to sort.