QuickSort (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.util, class: QuickSort

Package org.apache.hadoop.util

# Class QuickSort

java.lang.Object
org.apache.hadoop.util.QuickSort

All Implemented Interfaces:
  `IndexedSorter`

@Private @Unstable public final class QuickSort extends Object implements IndexedSorter
An implementation of the core algorithm of QuickSort.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `QuickSort()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected static int`
  `getMaxDepth(int x)`
  Deepest recursion before giving up and doing a heapsort.
  `void`
  `sort(IndexedSortable s, int p, int r)`
  Sort the given range of items using quick sort.
  `void`
  `sort(IndexedSortable s, int p, int r, Progressable rep)`
  Same as `IndexedSorter.sort(IndexedSortable,int,int)`, but indicate progress periodically.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### QuickSort

    public QuickSort()

- ## Method Details

  - ### getMaxDepth

    protected static int getMaxDepth(int x)
    Deepest recursion before giving up and doing a heapsort. Returns 2 * ceil(log(n)).
    Parameters:
      `x` - x.
    Returns:
      MaxDepth.

  - ### sort

    public void sort(IndexedSortable s, int p, int r)
    Sort the given range of items using quick sort. Sort the items accessed through the given IndexedSortable over the given range of logical indices. From the perspective of the sort algorithm, each index between l (inclusive) and r (exclusive) is an addressable entry. If the recursion depth falls below `getMaxDepth(int)`, then switch to `HeapSort`.
    Specified by:
      `sort` in interface `IndexedSorter`
    Parameters:
      `s` - s.
      `p` - l.
      `r` - r.
    See Also:
      - `IndexedSortable.compare(int, int)`
      - `IndexedSortable.swap(int, int)`

  - ### sort

    public void sort(IndexedSortable s, int p, int r, Progressable rep)
    Description copied from interface: `IndexedSorter`
    Same as `IndexedSorter.sort(IndexedSortable,int,int)`, but indicate progress periodically.
    Specified by:
      `sort` in interface `IndexedSorter`
    Parameters:
      `s` - s.
      `p` - l.
      `r` - r.
      `rep` - rep.
    See Also:
      - `IndexedSorter.sort(IndexedSortable,int,int)`