Problem 2 (5 pts). Write a method that finds the minimum of a generic array. The
ID: 3903361 • Letter: P
Question
Problem 2 (5 pts). Write a method that finds the minimum of a generic array. The method should takea generic array and returns the reference that points to the smallest element in the array. We must ensure that on arrays whose type has implemented the comparable interface can be passed to this method. Fill in the blanks to complete this method. The method from comparable is int compareTo (E o). It compares calling object with the specified object o for order. Returns a negative integer, zero, or a positive integer as calling object is less than, equal to, or greater than the specified object. public E findMin_1 list) - list[01 for (int í-0; ?Explanation / Answer
public E findMin(E[] list){ E min = list[0]; for(int i = 0;i 0){ min = list[i]; } } return min; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.