edu.gwu.algtest
Interface PartitionAlgorithm
- All Superinterfaces:
- Algorithm
- public interface PartitionAlgorithm
- extends Algorithm
Interface PartitionAlgorithm
is to be implemented
by algorithms that partition an array using one of the end elements.
Method Summary |
int |
leftIncreasingPartition(int[] data,
int left,
int right)
leftIncreasingPartition should partition the given
array only in the range data[left] ... |
int |
rightIncreasingPartition(int[] data,
int left,
int right)
rightIncreasingPartition is similar to
leftIncreasingPartition except that data[right]
is used. |
leftIncreasingPartition
public int leftIncreasingPartition(int[] data,
int left,
int right)
leftIncreasingPartition
should partition the given
array only in the range data[left] ... data[right] (both
values inclusive). This method should use data[left]
as the partitioning element and should return the index where
it gets located after partitioning. Suppose, for example,
data[left]==10. Then, after partitioning, suppose that this
value ends up in position 4, so data[4]==10. Then, data[i]<=10
when i is between "left" and 3, and data[i]>10 for all i
between 5 and "right".
- Parameters:
data
- an int[]
valueleft
- an int
valueright
- an int
value- Returns:
- an
int
value
rightIncreasingPartition
public int rightIncreasingPartition(int[] data,
int left,
int right)
rightIncreasingPartition
is similar to
leftIncreasingPartition
except that data[right]
is used.
- Parameters:
data
- an int[]
valueleft
- an int
valueright
- an int
value- Returns:
- an
int
value