0
/ 10
The code below finds the largest number in an int
array. What is the growth rate, Big O(), of this method?
// Return the position of...
The code below finds the largest number in an
int
array. What is the growth rate, Big O(), of this
method?
// Return the position of largest number
// in an array of integers
static int largest(int[] nums)
{
int currlarge = 0; // Pos of largest
for (int i = 1; i < nums.length; i++) {
if (nums[currlarge] < nums[i]) {
currlarge = i;
}
}
return currlarge;
}
Your feedback will appear here when you check your answer.