answersLogoWhite

0

class maximum
{
public static void main(string...args)
{
System.out.println(max(new int[]{5,3,6,2,4,61}));
}
static int max(int[]a)
{
int max=0;
for(int i=0;i{
if(a[i]>max)
max=a[i];
}
return max;
}
}

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What is the maximum number of comparisons required in a binary search algorithm to find a specific element in a sorted array?

The maximum number of comparisons required in a binary search algorithm to find a specific element in a sorted array is log(n), where n is the number of elements in the array.


Write a c program to find the maximum value of 25 element in an array?

int findMax(int *array) { int max = array[0]; for(int i = 1; i < array.length(); i++) { if(array[i] > max) max = array[i] } return max; }


Write a c program to find the maximum of two numbers and print out with its position?

maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know


What is the maximum number of entries that can be placed in the chained hash table?

The maximum number of entries that can be placed in a chained hash table is determined by the size of the underlying array used for storage. Each bucket in the array can hold multiple entries due to chaining, so the total number of entries that can be stored is dependent on the size of the array and the hashing function used.


How do you write the 8051 micro controller alp for finding the largest number in an array?

1


Maximum value of an array?

The maximum number of elements will depend on the type of array and the available memory. An array of char requires only 1 byte per element but an array of pointers requires 4 bytes per element (8 bytes on 64-bit systems). Arrays of objects or structures would likely require more memory per element.For all practical purposes, the maximum size is 2,147,483,647 elements, which is the maximum positive range for a 4-byte integer (0x7FFFFFFF). At 1 byte per element, that works out at 2GB.


What is sparce array?

sparse array is one which has contents lower than its maximum size, that is the array has free or empty locations....


What is the maximum co-efficient of a four dimensional array?

It depends on the size of the array. If you defined the array as 10 x 20 x 30 x 40... int a[10][20][30][40]; ...then the maximum element (coefficient?) number would be 9,19,29,39... int b = a[9][19][29][39];


You want to write a simple without using pointer or array c program which will print greatest number when you give 20 number?

i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?


How do you find maximum number in an array?

double max(const arr[], int arrSize){double maximum = arr[0];for (int j = 0; j < arrSize; j++){if (maximum < arr[j]){maximum = arr[j];}}return maximum;}


What a division sentence modeled by an array that has 2 more rows than the number in each row?

write a division sentence modeled by an array that has 2 more rows than the number in each row


What is squre array?

A square array is an array in which the number of rows is the same as the number of columns.