List Operations
A) Complete the public static Java method "reverseList" below that is supposed to
reverse the order of the elements in an ArrayList of Strings.  To accomplish
this task, you are not allowed to use any additional Lists or Collections.

    public static void reverseList(ArrayList<String> listOfWords)
    {
        // [Your Code Goes Here]
    }


B) Complete the public static Java method "removeMultipleSmallest" below that
is supposed to remove some of the smallest elements in an unordered ArrayList
of Integers.  The list, along with how many of the smallest numbers should be
removed, will be passed into the method.  The order of the numbers that are
not removed from the list must remain the same.  To accomplish this task, you
are not allowed to use any additional Lists or Collections.  Assume that the
ArrayList will contain at least two Integers, that every element in the list
will be different, and that the supplied amount of smallest Integers to be
removed will be less than the total number of Integers in the original list.

EXAMPLE #1:
If the original list is
    201, -9, 27, 12, 47, 0, 8, 153, -5
and the given amount of smallest numbers to be removed is 4,
then the list, after going through your method, should be
    201, 27, 12, 47, 153
because the four smallest integers will have been removed.

EXAMPLE #2:
If the original list is
    3210, 28, 99, 4000
and the given amount of smallest numbers to be removed is 3,
then the list, after going through your method, should be
    4000
because the three smallest integers will have been removed.

The above are examples; your method should work with any ArrayList of Integers.

    public static void removeMultipleSmallest(ArrayList<Integer> numberList, int howManyToRemove)
    {
        // [Your Code Goes Here]
    }


C) Complete the public static Java method "compact" below that is supposed to move
the non-zero numbers in an array of integers to the front of the list.  The
existing order of the non-zero elements must be maintained.  Note that you are
not deleting any elements from the array; you are simply rearranging the order
of the integers in the list.  To accomplish this task, you are not allowed to
use any additional Lists or Collections.

EXAMPLE:
If the original list is
    0, 17, 42, 0, 13, 0, 0, 51, 20, 9, 0, 33
then the list, after going through your method, should be
    17, 42, 13, 51, 20, 9, 33, 0, 0, 0, 0, 0
because all non-zero numbers will have been moved to the front of the list.

The above is an example; your method should work with any array of integers.

    public static void compact(int[] list)
    {
        // [Your Code Goes Here]
    }


ArrayLists and arrays are objects, and when an object is passed to a method,
what's actually happening is that a copy of the reference to that object is
passed to the method.  This means that any changes made to an ArrayList or
an array by your methods above will be reflected in the original ArrayLists
or arrays that are sent into your methods.  Therefore, none of your method
should return (or print) anything.

You should put all three of the above methods into a single file named
"ListOperations.java".  You may find it helpful to create a 'main' method in
that file from which you can call and test your methods as you write them.


Advanced Option
Copy the "reverseList" method above, change the name to "sortList",
and modify your code to create a new (fourth) method that modifies
the ArrayList so that the words are in non-descending alphabetical
order.  You must create your own code to sort the words.  That is,
you may not use any external Java classes or methods to do the
sorting for you.