Question: Need Help writing the Java code to implement the inPlaceInsertionSort() that takes an array of Clocks but do not create a new arrray to sort
Need Help writing the Java code to implement the inPlaceInsertionSort() that takes an array of Clocks but do not create a new arrray to sort in. The method must satisfy the following conditions. Below are the method of isbefore() and isAfter() that have been implemented inside the Clock class.


Implement a method inPlaceInsertionSort() that takes an array of Clocks as an input. Your method should:
- Sort in place, i.e (Dont create a new array to sort in)
- Use insertion sort algorithm to implement your method.
- Provide the Javadoc for your method.
- Add a brief discussing in you javadoc about the modifiers you used in
- implementing your method (Public, static...)
- Note that this method is not given in the skeleton file Clock.Java.
- Hint: you may use the methods isBefore and/or isAfter in your code.
public boolean is Before CClock d) if C hours d getHours return false; else if Chours d getHours return true; else if (minutes d get MinutesO) return false; else if (minutes d.getMinutesO return true: else if C seconds d get SecondsO) return false; else return true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
