To partition arrays and Deques of Strings
to experience the partition step of the Quicksort algorithm.
The completed assignment must be submitted as Homework 11 of CSCI 202 on Moodle by 11:00 PM Thursday, April 5.
Write two methods that implement that following headers:
public static Deque<String> partition(Deque<String>, String) ;public static String[] partition(String[], String) ;
These methods receive an
array or Deque of Strings and a pivot
String.
They will return a new array or Deque of Strings
which contains the same Strings as the input but where
the elements less than or equal to the pivot are stored at the beginning
of the new array or Deque.
If a String appears more than once in the input collection,
it should appear the same number of times in the output collection.
This actually makes the problem a lot easier.
This is not the same as partitioning the collection in place. Again, it is easier.