org.amino.alg.sort
Class ParallelQuickSorterWorkStealing

java.lang.Object
  extended by org.amino.alg.sort.AbstractSorter
      extended by org.amino.alg.sort.DefaultSorter
          extended by org.amino.alg.sort.QuickSorter
              extended by org.amino.alg.sort.ParallelQuickSorterWorkStealing
All Implemented Interfaces:
Sorter

public class ParallelQuickSorterWorkStealing
extends QuickSorter

This class provides a parallel quicksort implementation using a dynamic master-worker pattern.


Field Summary
 
Fields inherited from class org.amino.alg.sort.QuickSorter
is
 
Constructor Summary
ParallelQuickSorterWorkStealing()
          Constructor.
ParallelQuickSorterWorkStealing(int n)
          Constructor.
 
Method Summary
 void reverse(byte[] data, int from, int to)
          Sort array using reverse natural (descending) order.
 void reverse(char[] data, int from, int to)
          Sort array using reverse natural (descending) order.
 void reverse(double[] data, int from, int to)
          Sort array using reverse natural (descending) order.
 void reverse(float[] data, int from, int to)
          Sort array using reverse natural (descending) order.
 void reverse(int[] data, int from, int to)
          Sort array using reverse natural (descending) order.
 void reverse(long[] data, int from, int to)
          Sort array using reverse natural (descending) order.
 void reverse(short[] data, int from, int to)
          Sort array using reverse natural (descending) order.
 void sort(byte[] data, int from, int to)
          
 void sort(char[] data, int from, int to)
          
 void sort(double[] data, int from, int to)
          
 void sort(float[] data, int from, int to)
          
 void sort(int[] data, int from, int to)
          
 void sort(long[] data, int from, int to)
          
 void sort(short[] data, int from, int to)
          
 
Methods inherited from class org.amino.alg.sort.QuickSorter
median, median, median, median, median, median, median, ninther, selectPivot, selectPivot, selectPivot, selectPivot, selectPivot, selectPivot, selectPivot
 
Methods inherited from class org.amino.alg.sort.DefaultSorter
reverse, reverse, sort, sort, sort, sort, sort, sort, sortp
 
Methods inherited from class org.amino.alg.sort.AbstractSorter
reverse, reverse, reverse, reverse, reverse, reverse, reverse, reverse, reverse, sort, sort, sort, sort, sort, sort, sort, sort, sort, swap, swap, swap, swap, swap, swap, swap, swap, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParallelQuickSorterWorkStealing

public ParallelQuickSorterWorkStealing()
Constructor.


ParallelQuickSorterWorkStealing

public ParallelQuickSorterWorkStealing(int n)
Constructor.

Parameters:
n - is the number of workers to be used for the parallel quicksort
Method Detail

sort

public void sort(byte[] data,
                 int from,
                 int to)
Description copied from class: QuickSorter

Specified by:
sort in interface Sorter
Overrides:
sort in class QuickSorter
Parameters:
data - is the byte array to be sorted in an ascending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted
See Also:
Arrays.sort(byte[], int, int)

reverse

public void reverse(byte[] data,
                    int from,
                    int to)
Description copied from class: QuickSorter
Sort array using reverse natural (descending) order.

Specified by:
reverse in interface Sorter
Overrides:
reverse in class QuickSorter
Parameters:
data - is the byte array to be sorted in a descending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted

sort

public void sort(char[] data,
                 int from,
                 int to)
Description copied from class: QuickSorter

Specified by:
sort in interface Sorter
Overrides:
sort in class QuickSorter
Parameters:
data - is the character array to be sorted in an ascending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted
See Also:
Arrays.sort(byte[], int, int)

reverse

public void reverse(char[] data,
                    int from,
                    int to)
Description copied from class: QuickSorter
Sort array using reverse natural (descending) order.

Specified by:
reverse in interface Sorter
Overrides:
reverse in class QuickSorter
Parameters:
data - is the character array to be sorted in a descending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted

sort

public void sort(short[] data,
                 int from,
                 int to)
Description copied from class: QuickSorter

Specified by:
sort in interface Sorter
Overrides:
sort in class QuickSorter
Parameters:
data - is the short array to be sorted in an ascending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted
See Also:
Arrays.sort(short[], int, int)

reverse

public void reverse(short[] data,
                    int from,
                    int to)
Description copied from class: QuickSorter
Sort array using reverse natural (descending) order.

Specified by:
reverse in interface Sorter
Overrides:
reverse in class QuickSorter
Parameters:
data - is the short array to be sorted in a descending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted

sort

public void sort(int[] data,
                 int from,
                 int to)
Description copied from class: QuickSorter

Specified by:
sort in interface Sorter
Overrides:
sort in class QuickSorter
Parameters:
data - is the int array to be sorted in an ascending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted
See Also:
Arrays.sort(short[], int, int)

reverse

public void reverse(int[] data,
                    int from,
                    int to)
Description copied from class: QuickSorter
Sort array using reverse natural (descending) order.

Specified by:
reverse in interface Sorter
Overrides:
reverse in class QuickSorter
Parameters:
data - is the int array to be sorted in a descending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted

sort

public void sort(long[] data,
                 int from,
                 int to)
Description copied from class: QuickSorter

Specified by:
sort in interface Sorter
Overrides:
sort in class QuickSorter
Parameters:
data - is the long array to be sorted in an ascending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted
See Also:
Arrays.sort(short[], int, int)

reverse

public void reverse(long[] data,
                    int from,
                    int to)
Description copied from class: QuickSorter
Sort array using reverse natural (descending) order.

Specified by:
reverse in interface Sorter
Overrides:
reverse in class QuickSorter
Parameters:
data - is the long array to be sorted in a descending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted

sort

public void sort(float[] data,
                 int from,
                 int to)
Description copied from class: QuickSorter

Specified by:
sort in interface Sorter
Overrides:
sort in class QuickSorter
Parameters:
data - is the float array to be sorted in an ascending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted
See Also:
Arrays.sort(short[], int, int)

reverse

public void reverse(float[] data,
                    int from,
                    int to)
Description copied from class: QuickSorter
Sort array using reverse natural (descending) order.

Specified by:
reverse in interface Sorter
Overrides:
reverse in class QuickSorter
Parameters:
data - is the float array to be sorted in a descending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted

sort

public void sort(double[] data,
                 int from,
                 int to)
Description copied from class: QuickSorter

Specified by:
sort in interface Sorter
Overrides:
sort in class QuickSorter
Parameters:
data - is the double array to be sorted in an ascending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted
See Also:
Arrays.sort(short[], int, int)

reverse

public void reverse(double[] data,
                    int from,
                    int to)
Description copied from class: QuickSorter
Sort array using reverse natural (descending) order.

Specified by:
reverse in interface Sorter
Overrides:
reverse in class QuickSorter
Parameters:
data - is the double array to be sorted in a descending order using quicksort
from - is the start index of array to be sorted
to - is the end index of array to be sorted


Copyright © 2008. All Rights Reserved.