✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Consider the minimumPosition method from the SelectionSorter class. Complete the code to write a maximumPosition method that returns the index of the largest element in the range from index from to the end of the array.
private static int minimumPosition(int[] a, int from)
{
int minPos = from;
for (int i = from + 1; i < a.length; i++)
{
if (a[i] < a[minPos]) { minPos = i; }
}
return minPos;
}
private static int maximumPosition(int[] a, int from)
{
int maxPos = from;
for (int i = from + 1; i < a.length; i++)
{
________________
}
return maxPos;
}
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!