Algorithm
Development Kit 1.0

algs.model.array
Class PISelector

java.lang.Object
  extended by algs.model.array.PISelector
All Implemented Interfaces:
IPivotIndex

public class PISelector
extends java.lang.Object
implements IPivotIndex

Funky alternative for selecting a pivot index by using the digits of PI.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Constructor Summary
PISelector(int numDigits)
          Number of digits in a row that form the unique number.
 
Method Summary
 int selectPivotIndex(java.lang.Comparable[] ar, int left, int right)
          Return an index by using digits of PI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PISelector

public PISelector(int numDigits)
Number of digits in a row that form the unique number. Must be small enough to be an actual integer value.

Parameters:
numDigits -
Method Detail

selectPivotIndex

public int selectPivotIndex(java.lang.Comparable[] ar,
                            int left,
                            int right)
Return an index by using digits of PI.

Specified by:
selectPivotIndex in interface IPivotIndex
Parameters:
ar - base array of elements.
left - left index of sub-array
right - right index of sub-array
Returns:
an integer index value in the range [left,right] around which to pivot.

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.