Package pl.put.poznan.transformer.logic
Class QuickSort
- java.lang.Object
-
- pl.put.poznan.transformer.logic.QuickSort
-
- All Implemented Interfaces:
SortAlgorithm
public class QuickSort extends Object implements SortAlgorithm
A class containing an implementation of quicksort. Implements theSortAlgorithminterface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface pl.put.poznan.transformer.logic.SortAlgorithm
SortAlgorithm.Order
-
-
Constructor Summary
Constructors Constructor Description QuickSort()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanquickSort(Cell[][] tab, int column, int start, int end, int maxDepth, SortAlgorithm.Order order)An in-place implementation of the quicksort algorithmbooleansort(Cell[][] tab, int column, int maxIter, SortAlgorithm.Order order)A wrapper forquickSort(Cell[][], int, int, int, int, Order)compatible with theSortAlgorithminterface.
-
-
-
Method Detail
-
sort
public boolean sort(Cell[][] tab, int column, int maxIter, SortAlgorithm.Order order)
A wrapper forquickSort(Cell[][], int, int, int, int, Order)compatible with theSortAlgorithminterface.- Specified by:
sortin interfaceSortAlgorithm- Parameters:
tab- a 2-D array of typeCellto be sorted.column- the index of the column which will be the sorting criteria.maxIter- maximum recursion depth. Value of-1means unlimited iterations,<-1means none.order- an enum Order value determining the sorting direction.- Returns:
- a boolean value of whether sorting could be completed in the given number of iterations.
-
quickSort
public boolean quickSort(Cell[][] tab, int column, int start, int end, int maxDepth, SortAlgorithm.Order order)
An in-place implementation of the quicksort algorithm- Parameters:
tab- a 2-D array of typeCellto be sorted.column- the index of the column which will be the sorting criteria.start- the index of the first value to be included in the sorting.end- the index of the last value to be included in the sorting.maxDepth- maximum recursion depth. Value of-1means unlimited iterations,<-1means none.order- an enum Order value determining the sorting direction.- Returns:
- a boolean value of whether sorting could be completed in the given number of iterations.
-
-