Class MedianOf3PivotingStrategy

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int pivotIndex​(double[] work, int begin, int end)
      Find pivot index of the array so that partition and Kth element selection can be made
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MedianOf3PivotingStrategy

        public MedianOf3PivotingStrategy()
    • Method Detail

      • pivotIndex

        public int pivotIndex​(double[] work,
                              int begin,
                              int end)
        Find pivot index of the array so that partition and Kth element selection can be made This in specific makes use of median of 3 pivoting.
        Specified by:
        pivotIndex in interface PivotingStrategyInterface
        Parameters:
        work - data array
        begin - index of the first element of the slice
        end - index after the last element of the slice
        Returns:
        The index corresponding to a pivot chosen between the first, middle and the last indices of the array slice