gishur.core
Class Sorter

java.lang.Object
  |
  +--gishur.core.Sorter

public class Sorter
extends java.lang.Object

This class implements several sorting-algorithms. To compare the objects which shall be sort, a Comparitor is used. If no Comparitor is set, a StdComparitor will be used. To sort a set of elements, procede like the following:

Instead of performing the last three operations step by step, a sorting-method can also be called with a data-structure as argument and optional interval-bounds. The sorting-algorithm will return a structure of the same type containing the sorted data. For example:
 Sorter S=new Sorter();
 int[] array=new int[5000];
 ... // code filling 'array' with ints...
 int[] sortedArray=S.HeapSort(array,15,1500); // sorts the interval from array[15] to array[1500] with HeapSort()
   																			 // and stores the sorted data in 'sortedArray'
 
ATTENTION! A Sorter-object is no structure to store objects. As few add(java.lang.Object)-methods as possible should be called in a sorting-process, preferably only one.

Version:
1.3
Author:
Thomas Wolf
See Also:
Comparitor, StdComparitor

Field Summary
protected  Comparitor _comparitor
          The set Comparitor.
static byte ASCENDING
          A constant for sorting in ascending order.
static byte DESCENDING
          A constant for sorting in descending order.
 
Constructor Summary
Sorter()
          Standard constructor.
Sorter(Comparitor c)
          Constructor setting a Comparitor or creating a new StdComparitor, if c==null.
 
Method Summary
 void add(BasicList L)
          Adds the contents of a list (SimpleList, Queue, Stack) to the Sorter.
 void add(boolean b)
          Adds a boolean-value b to _data.
 void add(boolean[] o)
          Sets the array of data to be sorted directly to the boolean-array o.
 void add(boolean[] o, int l, int r)
          Sets the array of data to be sorted directly to the boolean-array o.
 void add(char c)
          Adds a char-value c to _data.
 void add(char[] o)
          Sets the array of data to be sorted directly to the char-array o.
 void add(char[] o, int l, int r)
          Sets the array of data to be sorted directly to the char-array o.
 void add(double d)
          Adds a double-value d to _data.
 void add(double[] o)
          Sets the array of data to be sorted directly to the double-array o.
 void add(double[] o, int l, int r)
          Sets the array of data to be sorted directly to the double-array o.
 void add(java.util.Enumeration enum)
          Adds the contents of the java.util.Enumeration-object enum to the Sorter.
 void add(float f)
          Adds a float-value f to _data.
 void add(float[] o)
          Sets the array of data to be sorted directly to the float-array o.
 void add(float[] o, int l, int r)
          Sets the array of data to be sorted directly to the float-array o.
 void add(int i)
          Adds an int-value i to _data.
 void add(int[] o)
          Sets the array of data to be sorted directly to the int-array o.
 void add(int[] o, int l, int r)
          Sets the array of data to be sorted directly to the int-array o.
 void add(long l)
          Adds a long-value l to _data.
 void add(long[] o)
          Sets the array of data to be sorted directly to the long-array o.
 void add(long[] o, int l, int r)
          Sets the array of data to be sorted directly to the long-array o.
 void add(java.lang.Object o)
          Adds an object o to _data.
 void add(java.lang.Object[] o)
          Sets the array of data to be sorted directly to the Object-array o.
 void add(java.lang.Object[] o, int l, int r)
          Adds an interval of array o to _data.
 int BinSearch(int l, int r, java.lang.Object o)
          Works the same way like BinSearch(Object[],int,int,Object), except that the search takes place in the sorted data array of this Sorter.
 int BinSearch(java.lang.Object o)
          Works like BinSearch(int,int,Object), but without interval bounds the whole data array will be searched.
 int BinSearch(java.lang.Object[] array, int l, int r, java.lang.Object o)
          Binary search for Object o in interval from 1 to r of the sorted array array.
 void BubbleSort()
          Bubble-Sort.
 List BubbleSort(BasicList L)
          BubbleSort() performed on a BasicList.
 char[] BubbleSort(char[] o)
          BubbleSort() directly called with an array of chars.
 char[] BubbleSort(char[] o, int l, int r)
          BubbleSort() directly called with an array of chars and an interval bounds specification.
 double[] BubbleSort(double[] o)
          BubbleSort() directly called with an array of doubles.
 double[] BubbleSort(double[] o, int l, int r)
          BubbleSort() directly called with an array of doubles and an interval bounds specification.
 java.util.Enumeration BubbleSort(java.util.Enumeration enum)
          BubbleSort() performed on an Enumeration.
 float[] BubbleSort(float[] o)
          BubbleSort() directly called with an array of floats.
 float[] BubbleSort(float[] o, int l, int r)
          BubbleSort() directly called with an array of floats and an interval bounds specification.
 int[] BubbleSort(int[] o)
          BubbleSort() directly called with an array of ints.
 int[] BubbleSort(int[] o, int l, int r)
          BubbleSort() directly called with an array of ints and an interval bounds specification.
 long[] BubbleSort(long[] o)
          BubbleSort() directly called with an array of longs.
 long[] BubbleSort(long[] o, int l, int r)
          BubbleSort() directly called with an array of longs and an interval bounds specification.
 java.lang.Object[] BubbleSort(java.lang.Object[] o)
          BubbleSort() directly called with an array of Objects.
 java.lang.Object[] BubbleSort(java.lang.Object[] o, int l, int r)
          BubbleSort() directly called with an array of Objects and an interval bounds specification.
 void clear()
          Removes all stored data from the Sorter.
 java.lang.Object[] getArray()
          Returns the sorted data as an array of Objects.
 boolean[] getBooleanArray()
          Returns an array containing all elements of _data which are instances of java.lang.Boolean converted into boolean in sorted order.
 char[] getCharArray()
          Returns an array containing all elements of _data which are instances of java.lang.Character converted into char in sorted order.
 Comparitor getComparitor()
          Returns the actually set Comparitor for this Sorter.
 double[] getDoubleArray()
          Returns an array containing all elements of _data which are instances of java.lang.Number converted into double in sorted order.
 java.util.Enumeration getEnumeration()
          Returns a java.util.Enumeration-object enumerating the sorted data.
 float[] getFloatArray()
          Returns an array containing all elements of _data which are instances of java.lang.Number converted into float in sorted order.
 int[] getIntArray()
          Returns an array containing all elements of _data which are instances of java.lang.Number converted into int in sorted order.
 List getList()
          Returns the sorted data in a List.
 long[] getLongArray()
          Returns an array containing all elements of _data which are instances of java.lang.Number converted into long in sorted order.
 List getQueue()
          Returns the sorted data in a Queue.
 SimpleList getSimpleList()
          Returns the sorted data in a SimpleList.
 List getStack()
          Returns the sorted data in a Stack.
protected  java.lang.Object[] getUnsortedArray()
          Returns the unsorted array of data.
 void HeapSort()
          The Heapsort-algorithm.
 List HeapSort(BasicList L)
          HeapSort() performed on a BasicList.
 char[] HeapSort(char[] o)
          HeapSort() directly called with an array of chars.
 char[] HeapSort(char[] o, int l, int r)
          HeapSort() directly called with an array of chars and an interval bounds specification.
 double[] HeapSort(double[] o)
          HeapSort() directly called with an array of doubles.
 double[] HeapSort(double[] o, int l, int r)
          HeapSort() directly called with an array of doubles and an interval bounds specification.
 java.util.Enumeration HeapSort(java.util.Enumeration enum)
          HeapSort() performed on an Enumeration.
 float[] HeapSort(float[] o)
          HeapSort() directly called with an array of floats.
 float[] HeapSort(float[] o, int l, int r)
          HeapSort() directly called with an array of floats and an interval bounds specification.
 int[] HeapSort(int[] o)
          HeapSort() directly called with an array of ints.
 int[] HeapSort(int[] o, int l, int r)
          HeapSort() directly called with an array of ints and an interval bounds specification.
 long[] HeapSort(long[] o)
          HeapSort() directly called with an array of longs.
 long[] HeapSort(long[] o, int l, int r)
          HeapSort() directly called with an array of longs and an interval bounds specification.
 java.lang.Object[] HeapSort(java.lang.Object[] o)
          HeapSort() directly called with an array of Objects.
 java.lang.Object[] HeapSort(java.lang.Object[] o, int l, int r)
          HeapSort() directly called with an array of Objects and an interval bounds specification.
 boolean isSorted()
          Returns true if sorting has taken place already.
 int length()
          Returns the number of objects which are stored for sorting at the moment.
 void QuickSort()
          The Quicksort-algorithm.
 List QuickSort(BasicList L)
          QuickSort() performed on a BasicList.
 char[] QuickSort(char[] o)
          QuickSort() directly called with an array of chars.
 char[] QuickSort(char[] o, int l, int r)
          QuickSort() directly called with an array of chars and an interval bounds specification.
 double[] QuickSort(double[] o)
          QuickSort() directly called with an array of doubles.
 double[] QuickSort(double[] o, int l, int r)
          QuickSort() directly called with an array of doubles and an interval bounds specification.
 java.util.Enumeration QuickSort(java.util.Enumeration enum)
          QuickSort() performed on an Enumeration.
 float[] QuickSort(float[] o)
          QuickSort() directly called with an array of floats.
 float[] QuickSort(float[] o, int l, int r)
          QuickSort() directly called with an array of floats and an interval bounds specification.
 int[] QuickSort(int[] o)
          QuickSort() directly called with an array of ints.
 int[] QuickSort(int[] o, int l, int r)
          QuickSort() directly called with an array of ints and an interval bounds specification.
 long[] QuickSort(long[] o)
          QuickSort() directly called with an array of longs.
 long[] QuickSort(long[] o, int l, int r)
          QuickSort() directly called with an array of longs and an interval bounds specification.
 java.lang.Object[] QuickSort(java.lang.Object[] o)
          QuickSort() directly called with an array of Objects.
 java.lang.Object[] QuickSort(java.lang.Object[] o, int l, int r)
          QuickSort() directly called with an array of Objects and an interval bounds specification.
protected  void setArray(java.lang.Object[] array)
          Sets the array containing the data to sort directly to array!
 void setAscendingOrder()
          Commands the Sorter to sort the data in ascending order in the next sorting-process.
 void setComparitor(Comparitor c)
          Sets the Comparitor.
 void setDescendingOrder()
          Commands the Sorter to sort the data in descending order in the next sorting-process.
 void sort()
          The standard sorting method.
 List sort(BasicList L)
          sort() performed on a BasicList.
 char[] sort(char[] o)
          sort() directly called with an array of chars.
 char[] sort(char[] o, int l, int r)
          sort() directly called with an array of chars and an interval bounds specification.
 double[] sort(double[] o)
          sort() directly called with an array of doubles.
 double[] sort(double[] o, int l, int r)
          sort() directly called with an array of doubles and an interval bounds specification.
 java.util.Enumeration sort(java.util.Enumeration enum)
          sort() performed on an Enumeration.
 float[] sort(float[] o)
          sort() directly called with an array of floats.
 float[] sort(float[] o, int l, int r)
          sort() directly called with an array of floats and an interval bounds specification.
 int[] sort(int[] o)
          sort() directly called with an array of ints.
 int[] sort(int[] o, int l, int r)
          sort() directly called with an array of ints and an interval bounds specification.
 long[] sort(long[] o)
          sort() directly called with an array of longs.
 long[] sort(long[] o, int l, int r)
          sort() directly called with an array of longs and an interval bounds specification.
 java.lang.Object[] sort(java.lang.Object[] o)
          sort() directly called with an array of Objects.
 java.lang.Object[] sort(java.lang.Object[] o, int l, int r)
          sort() directly called with an array of Objects and an interval bounds specification.
 void storeInList(BasicList L)
          Stores the content of this Sorter-object (sorted or not) int BasicList L.
 java.lang.String toString()
          Overrides java.lang.Object.toString().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_comparitor

protected Comparitor _comparitor
The set Comparitor.

ASCENDING

public static final byte ASCENDING
A constant for sorting in ascending order.

DESCENDING

public static final byte DESCENDING
A constant for sorting in descending order.
Constructor Detail

Sorter

public Sorter(Comparitor c)
Constructor setting a Comparitor or creating a new StdComparitor, if c==null.
Parameters:
c - Comparitor to compare the objects in this Sorter

Sorter

public Sorter()
Standard constructor.
Method Detail

toString

public java.lang.String toString()
Overrides java.lang.Object.toString().
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

clear

public void clear()
Removes all stored data from the Sorter.

setComparitor

public void setComparitor(Comparitor c)
Sets the Comparitor.
Parameters:
c - new Comparitor-object

getComparitor

public Comparitor getComparitor()
Returns the actually set Comparitor for this Sorter.
Returns:
this Sorter's Comparitor-object

setAscendingOrder

public void setAscendingOrder()
Commands the Sorter to sort the data in ascending order in the next sorting-process.

setDescendingOrder

public void setDescendingOrder()
Commands the Sorter to sort the data in descending order in the next sorting-process.

length

public int length()
Returns the number of objects which are stored for sorting at the moment.
Returns:
number of stored objects

isSorted

public boolean isSorted()
Returns true if sorting has taken place already.
Returns:
true, if _data has been sorted already

setArray

protected void setArray(java.lang.Object[] array)
Sets the array containing the data to sort directly to array!
Parameters:
array - an array of objects

add

public void add(java.lang.Object o)
Adds an object o to _data.

add

public void add(int i)
Adds an int-value i to _data.

add

public void add(long l)
Adds a long-value l to _data.

add

public void add(float f)
Adds a float-value f to _data.

add

public void add(double d)
Adds a double-value d to _data.

add

public void add(char c)
Adds a char-value c to _data.

add

public void add(boolean b)
Adds a boolean-value b to _data.

add

public void add(java.lang.Object[] o,
                int l,
                int r)
Adds an interval of array o to _data.
Parameters:
o - an array of type Object
l - lower interval bound
r - upper interval bound

add

public void add(java.lang.Object[] o)
Sets the array of data to be sorted directly to the Object-array o.
Parameters:
o - an array of type Object

add

public void add(int[] o,
                int l,
                int r)
Sets the array of data to be sorted directly to the int-array o.
Parameters:
o - an array of type int
l - lower interval bound
r - upper interval bound

add

public void add(int[] o)
Sets the array of data to be sorted directly to the int-array o.
Parameters:
o - an array of type Object

add

public void add(long[] o,
                int l,
                int r)
Sets the array of data to be sorted directly to the long-array o.
Parameters:
o - an array of type long
l - lower interval bound
r - upper interval bound

add

public void add(long[] o)
Sets the array of data to be sorted directly to the long-array o.
Parameters:
o - an array of type long

add

public void add(float[] o,
                int l,
                int r)
Sets the array of data to be sorted directly to the float-array o.
Parameters:
o - an array of type float
l - lower interval bound
r - upper interval bound

add

public void add(float[] o)
Sets the array of data to be sorted directly to the float-array o.
Parameters:
o - an array of type float

add

public void add(double[] o,
                int l,
                int r)
Sets the array of data to be sorted directly to the double-array o.
Parameters:
o - an array of type double
l - lower interval bound
r - upper interval bound

add

public void add(double[] o)
Sets the array of data to be sorted directly to the double-array o.
Parameters:
o - an array of type double

add

public void add(char[] o,
                int l,
                int r)
Sets the array of data to be sorted directly to the char-array o.
Parameters:
o - an array of type char
l - lower interval bound
r - upper interval bound

add

public void add(char[] o)
Sets the array of data to be sorted directly to the char-array o.
Parameters:
o - an array of type char

add

public void add(boolean[] o,
                int l,
                int r)
Sets the array of data to be sorted directly to the boolean-array o.
Parameters:
o - an array of type boolean
l - lower interval bound
r - upper interval bound

add

public void add(boolean[] o)
Sets the array of data to be sorted directly to the boolean-array o.
Parameters:
o - an array of type boolean

add

public void add(BasicList L)
Adds the contents of a list (SimpleList, Queue, Stack) to the Sorter.
Parameters:
L - an object of type BasicList

add

public void add(java.util.Enumeration enum)
Adds the contents of the java.util.Enumeration-object enum to the Sorter.
Parameters:
enum - an object of type java.util.Enumeration

getArray

public java.lang.Object[] getArray()
Returns the sorted data as an array of Objects.
Returns:
an array of type Object containing the sorted data

getUnsortedArray

protected java.lang.Object[] getUnsortedArray()
Returns the unsorted array of data. If modifications are performed on this array, this will influence the data to sort, because the returned array contains the same references as _data.
Returns:
the array storing the Sorter's data

getIntArray

public int[] getIntArray()
Returns an array containing all elements of _data which are instances of java.lang.Number converted into int in sorted order.
Returns:
all java.lang.Numbers converted into int-values and sorted in an array

getLongArray

public long[] getLongArray()
Returns an array containing all elements of _data which are instances of java.lang.Number converted into long in sorted order.
Returns:
all java.lang.Numbers converted into long-values and sorted in an array

getFloatArray

public float[] getFloatArray()
Returns an array containing all elements of _data which are instances of java.lang.Number converted into float in sorted order.
Returns:
all java.lang.Numbers converted into float-values and sorted in an array

getDoubleArray

public double[] getDoubleArray()
Returns an array containing all elements of _data which are instances of java.lang.Number converted into double in sorted order.
Returns:
all java.lang.Numbers converted into double-values and sorted in an array

getBooleanArray

public boolean[] getBooleanArray()
Returns an array containing all elements of _data which are instances of java.lang.Boolean converted into boolean in sorted order.
Returns:
all java.lang.Booleans converted into boolean-values and sorted in an array

getCharArray

public char[] getCharArray()
Returns an array containing all elements of _data which are instances of java.lang.Character converted into char in sorted order.
Returns:
all java.lang.Characters converted into char-values and sorted in an array

storeInList

public void storeInList(BasicList L)
Stores the content of this Sorter-object (sorted or not) int BasicList L. If forward==true, the data will be appended to the end of the list, otherwise to the beginning.
Parameters:
L - BasicList-object, in which to store this Sorter's data
forward - direction in which to append the data to the list

getSimpleList

public SimpleList getSimpleList()
Returns the sorted data in a SimpleList.
Returns:
SimpleList containing sorted data

getList

public List getList()
Returns the sorted data in a List.
Returns:
List containing sorted data

getQueue

public List getQueue()
Returns the sorted data in a Queue.
Returns:
Queue containing sorted data

getStack

public List getStack()
Returns the sorted data in a Stack.
Returns:
Stack containing sorted data

getEnumeration

public java.util.Enumeration getEnumeration()
Returns a java.util.Enumeration-object enumerating the sorted data.
Returns:
an Enumeration for the sorted data

sort

public void sort()
The standard sorting method. If _data contains less than ten elements, BubbleSort() will be performed, otherwise HeapSort().

BubbleSort

public void BubbleSort()
Bubble-Sort. Processing time: O(n^2). Stops, if no further element swaps are necessary to sort the data.

HeapSort

public void HeapSort()
The Heapsort-algorithm. Processing time: O(log(n)*n).

QuickSort

public void QuickSort()
The Quicksort-algorithm.

BinSearch

public int BinSearch(java.lang.Object[] array,
                     int l,
                     int r,
                     java.lang.Object o)
Binary search for Object o in interval from 1 to r of the sorted array array.
Parameters:
array - sorted array to search in
l - lower search interval bound
r - upper search interval bound
o - Object to search for
Returns:
index of o in array, or -1, if o was not found in array
See Also:
BinSearch(int,int,Object), BinSearch(Object)

BinSearch

public int BinSearch(int l,
                     int r,
                     java.lang.Object o)
Works the same way like BinSearch(Object[],int,int,Object), except that the search takes place in the sorted data array of this Sorter. If the Sorter's data array is not already sorted, sort() will be called.
Parameters:
l - lower search interval bound
r - upper search interval bound
o - Object to search for
Returns:
index of o in _data, or -1, if o was not found in this Sorter
See Also:
BinSearch(Object[],int,int,Object), BinSearch(Object)

BinSearch

public int BinSearch(java.lang.Object o)
Works like BinSearch(int,int,Object), but without interval bounds the whole data array will be searched.
Parameters:
o - Object to search for
Returns:
index of o in _data, or -1, if o was not found in this Sorter
See Also:
BinSearch(int,int,Object), BinSearch(Object[],int,int,Object)

BubbleSort

public java.lang.Object[] BubbleSort(java.lang.Object[] o)
BubbleSort() directly called with an array of Objects.
Parameters:
o - an array of type Object containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
BubbleSort()

BubbleSort

public java.lang.Object[] BubbleSort(java.lang.Object[] o,
                                     int l,
                                     int r)
BubbleSort() directly called with an array of Objects and an interval bounds specification.
Parameters:
o - an array of type Object containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type Object containing the sorted elements of the interval o[l] to o[r]
See Also:
BubbleSort()

BubbleSort

public int[] BubbleSort(int[] o)
BubbleSort() directly called with an array of ints.
Parameters:
o - an array of type int containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
BubbleSort()

BubbleSort

public int[] BubbleSort(int[] o,
                        int l,
                        int r)
BubbleSort() directly called with an array of ints and an interval bounds specification.
Parameters:
o - an array of type int containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type int containing the sorted elements of the interval o[l] to o[r]
See Also:
BubbleSort()

BubbleSort

public long[] BubbleSort(long[] o)
BubbleSort() directly called with an array of longs.
Parameters:
o - an array of type long containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
BubbleSort()

BubbleSort

public long[] BubbleSort(long[] o,
                         int l,
                         int r)
BubbleSort() directly called with an array of longs and an interval bounds specification.
Parameters:
o - an array of type long containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type long containing the sorted elements of the interval o[l] to o[r]
See Also:
BubbleSort()

BubbleSort

public float[] BubbleSort(float[] o)
BubbleSort() directly called with an array of floats.
Parameters:
o - an array of type float containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
BubbleSort()

BubbleSort

public float[] BubbleSort(float[] o,
                          int l,
                          int r)
BubbleSort() directly called with an array of floats and an interval bounds specification.
Parameters:
o - an array of type float containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type float containing the sorted elements of the interval o[l] to o[r]
See Also:
BubbleSort()

BubbleSort

public double[] BubbleSort(double[] o)
BubbleSort() directly called with an array of doubles.
Parameters:
o - an array of type double containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
BubbleSort()

BubbleSort

public double[] BubbleSort(double[] o,
                           int l,
                           int r)
BubbleSort() directly called with an array of doubles and an interval bounds specification.
Parameters:
o - an array of type double containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type double containing the sorted elements of the interval o[l] to o[r]
See Also:
BubbleSort()

BubbleSort

public char[] BubbleSort(char[] o)
BubbleSort() directly called with an array of chars.
Parameters:
o - an array of type char containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
BubbleSort()

BubbleSort

public char[] BubbleSort(char[] o,
                         int l,
                         int r)
BubbleSort() directly called with an array of chars and an interval bounds specification.
Parameters:
o - an array of type char containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type char containing the sorted elements of the interval o[l] to o[r]
See Also:
BubbleSort()

BubbleSort

public List BubbleSort(BasicList L)
BubbleSort() performed on a BasicList.
Parameters:
L - a BasicList containing the data to sort.
Returns:
a new BasicList containing L's sorted elements.
See Also:
BubbleSort()

BubbleSort

public java.util.Enumeration BubbleSort(java.util.Enumeration enum)
BubbleSort() performed on an Enumeration.
Parameters:
enum - an object of type java.util.Enumeration enumerating the elements to sort.
Returns:
a new Enumeration which enumerates all elments in the right order
See Also:
BubbleSort()

HeapSort

public java.lang.Object[] HeapSort(java.lang.Object[] o)
HeapSort() directly called with an array of Objects.
Parameters:
o - an array of type Object containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
HeapSort()

HeapSort

public java.lang.Object[] HeapSort(java.lang.Object[] o,
                                   int l,
                                   int r)
HeapSort() directly called with an array of Objects and an interval bounds specification.
Parameters:
o - an array of type Object containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type Object containing the sorted elements of the interval o[l] to o[r]
See Also:
HeapSort()

HeapSort

public int[] HeapSort(int[] o)
HeapSort() directly called with an array of ints.
Parameters:
o - an array of type int containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
HeapSort()

HeapSort

public int[] HeapSort(int[] o,
                      int l,
                      int r)
HeapSort() directly called with an array of ints and an interval bounds specification.
Parameters:
o - an array of type int containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type int containing the sorted elements of the interval o[l] to o[r]
See Also:
HeapSort()

HeapSort

public long[] HeapSort(long[] o)
HeapSort() directly called with an array of longs.
Parameters:
o - an array of type long containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
HeapSort()

HeapSort

public long[] HeapSort(long[] o,
                       int l,
                       int r)
HeapSort() directly called with an array of longs and an interval bounds specification.
Parameters:
o - an array of type long containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type long containing the sorted elements of the interval o[l] to o[r]
See Also:
HeapSort()

HeapSort

public float[] HeapSort(float[] o)
HeapSort() directly called with an array of floats.
Parameters:
o - an array of type float containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
HeapSort()

HeapSort

public float[] HeapSort(float[] o,
                        int l,
                        int r)
HeapSort() directly called with an array of floats and an interval bounds specification.
Parameters:
o - an array of type float containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type float containing the sorted elements of the interval o[l] to o[r]
See Also:
HeapSort()

HeapSort

public double[] HeapSort(double[] o)
HeapSort() directly called with an array of doubles.
Parameters:
o - an array of type double containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
HeapSort()

HeapSort

public double[] HeapSort(double[] o,
                         int l,
                         int r)
HeapSort() directly called with an array of doubles and an interval bounds specification.
Parameters:
o - an array of type double containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type double containing the sorted elements of the interval o[l] to o[r]
See Also:
HeapSort()

HeapSort

public char[] HeapSort(char[] o)
HeapSort() directly called with an array of chars.
Parameters:
o - an array of type char containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
HeapSort()

HeapSort

public char[] HeapSort(char[] o,
                       int l,
                       int r)
HeapSort() directly called with an array of chars and an interval bounds specification.
Parameters:
o - an array of type char containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type char containing the sorted elements of the interval o[l] to o[r]
See Also:
HeapSort()

HeapSort

public List HeapSort(BasicList L)
HeapSort() performed on a BasicList.
Parameters:
L - a BasicList containing the data to sort.
Returns:
a new BasicList containing L's sorted elements.
See Also:
HeapSort()

HeapSort

public java.util.Enumeration HeapSort(java.util.Enumeration enum)
HeapSort() performed on an Enumeration.
Parameters:
enum - an object of type java.util.Enumeration enumerating the elements to sort.
Returns:
a new Enumeration which enumerates all elments in the right order
See Also:
HeapSort()

QuickSort

public java.lang.Object[] QuickSort(java.lang.Object[] o)
QuickSort() directly called with an array of Objects.
Parameters:
o - an array of type Object containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
QuickSort()

QuickSort

public java.lang.Object[] QuickSort(java.lang.Object[] o,
                                    int l,
                                    int r)
QuickSort() directly called with an array of Objects and an interval bounds specification.
Parameters:
o - an array of type Object containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type Object containing the sorted elements of the interval o[l] to o[r]
See Also:
QuickSort()

QuickSort

public int[] QuickSort(int[] o)
QuickSort() directly called with an array of ints.
Parameters:
o - an array of type int containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
QuickSort()

QuickSort

public int[] QuickSort(int[] o,
                       int l,
                       int r)
QuickSort() directly called with an array of ints and an interval bounds specification.
Parameters:
o - an array of type int containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type int containing the sorted elements of the interval o[l] to o[r]
See Also:
QuickSort()

QuickSort

public long[] QuickSort(long[] o)
QuickSort() directly called with an array of longs.
Parameters:
o - an array of type long containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
QuickSort()

QuickSort

public long[] QuickSort(long[] o,
                        int l,
                        int r)
QuickSort() directly called with an array of longs and an interval bounds specification.
Parameters:
o - an array of type long containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type long containing the sorted elements of the interval o[l] to o[r]
See Also:
QuickSort()

QuickSort

public float[] QuickSort(float[] o)
QuickSort() directly called with an array of floats.
Parameters:
o - an array of type float containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
QuickSort()

QuickSort

public float[] QuickSort(float[] o,
                         int l,
                         int r)
QuickSort() directly called with an array of floats and an interval bounds specification.
Parameters:
o - an array of type float containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type float containing the sorted elements of the interval o[l] to o[r]
See Also:
QuickSort()

QuickSort

public double[] QuickSort(double[] o)
QuickSort() directly called with an array of doubles.
Parameters:
o - an array of type double containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
QuickSort()

QuickSort

public double[] QuickSort(double[] o,
                          int l,
                          int r)
QuickSort() directly called with an array of doubles and an interval bounds specification.
Parameters:
o - an array of type double containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type double containing the sorted elements of the interval o[l] to o[r]
See Also:
QuickSort()

QuickSort

public char[] QuickSort(char[] o)
QuickSort() directly called with an array of chars.
Parameters:
o - an array of type char containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
QuickSort()

QuickSort

public char[] QuickSort(char[] o,
                        int l,
                        int r)
QuickSort() directly called with an array of chars and an interval bounds specification.
Parameters:
o - an array of type char containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type char containing the sorted elements of the interval o[l] to o[r]
See Also:
QuickSort()

QuickSort

public List QuickSort(BasicList L)
QuickSort() performed on a BasicList.
Parameters:
L - a BasicList containing the data to sort.
Returns:
a new BasicList containing L's sorted elements.
See Also:
QuickSort()

QuickSort

public java.util.Enumeration QuickSort(java.util.Enumeration enum)
QuickSort() performed on an Enumeration.
Parameters:
enum - an object of type java.util.Enumeration enumerating the elements to sort.
Returns:
a new Enumeration which enumerates all elments in the right order
See Also:
QuickSort()

sort

public java.lang.Object[] sort(java.lang.Object[] o)
sort() directly called with an array of Objects.
Parameters:
o - an array of type Object containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
sort()

sort

public java.lang.Object[] sort(java.lang.Object[] o,
                               int l,
                               int r)
sort() directly called with an array of Objects and an interval bounds specification.
Parameters:
o - an array of type Object containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type Object containing the sorted elements of the interval o[l] to o[r]
See Also:
sort()

sort

public int[] sort(int[] o)
sort() directly called with an array of ints.
Parameters:
o - an array of type int containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
sort()

sort

public int[] sort(int[] o,
                  int l,
                  int r)
sort() directly called with an array of ints and an interval bounds specification.
Parameters:
o - an array of type int containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type int containing the sorted elements of the interval o[l] to o[r]
See Also:
sort()

sort

public long[] sort(long[] o)
sort() directly called with an array of longs.
Parameters:
o - an array of type long containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
sort()

sort

public long[] sort(long[] o,
                   int l,
                   int r)
sort() directly called with an array of longs and an interval bounds specification.
Parameters:
o - an array of type long containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type long containing the sorted elements of the interval o[l] to o[r]
See Also:
sort()

sort

public float[] sort(float[] o)
sort() directly called with an array of floats.
Parameters:
o - an array of type float containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
sort()

sort

public float[] sort(float[] o,
                    int l,
                    int r)
sort() directly called with an array of floats and an interval bounds specification.
Parameters:
o - an array of type float containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type float containing the sorted elements of the interval o[l] to o[r]
See Also:
sort()

sort

public double[] sort(double[] o)
sort() directly called with an array of doubles.
Parameters:
o - an array of type double containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
sort()

sort

public double[] sort(double[] o,
                     int l,
                     int r)
sort() directly called with an array of doubles and an interval bounds specification.
Parameters:
o - an array of type double containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type double containing the sorted elements of the interval o[l] to o[r]
See Also:
sort()

sort

public char[] sort(char[] o)
sort() directly called with an array of chars.
Parameters:
o - an array of type char containing the data to sort.
Returns:
an array of the same size, but now containing the elements in sorted order
See Also:
sort()

sort

public char[] sort(char[] o,
                   int l,
                   int r)
sort() directly called with an array of chars and an interval bounds specification.
Parameters:
o - an array of type char containing the data to sort.
l - lower interval bound
r - upper interval bound
Returns:
an array of type char containing the sorted elements of the interval o[l] to o[r]
See Also:
sort()

sort

public List sort(BasicList L)
sort() performed on a BasicList.
Parameters:
L - a BasicList containing the data to sort.
Returns:
a new BasicList containing L's sorted elements.
See Also:
sort()

sort

public java.util.Enumeration sort(java.util.Enumeration enum)
sort() performed on an Enumeration.
Parameters:
enum - an object of type java.util.Enumeration enumerating the elements to sort.
Returns:
a new Enumeration which enumerates all elments in the right order
See Also:
sort()