beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Quicksort Partition (First Value)

Geoffrey Challen // 2020.6.0

Create a public, non-final class named Partitioner. Implement a public static method int partition(int[] values) that returns the input array partitioned using the first array value as the pivot. All values smaller than the pivot should precede it in the array, and all values larger than or equal to the pivot should follow it. Your method should return the index of the pivot value. If the array is null or empty you should return -1.