Write the code necessary to find the largest element in an unsorted array of integers. What is the time complexity of this algorithm?
What will be an ideal response?
```
int max;
if (intArray.length > 0)
{
max = intArray[0];
for (int num = 1; num < intArray.length; num++)
if (intArray[num] > max)
max = intArray[num];
System.out.println (max);
}
else
{
System.out.println ("The array is empty.");
}
```
Computer Science & Information Technology
You might also like to view...
Which authentication method sends the password in cleartext?
A. PAP B. CHAP C. EAP D. MS-CHAP
Computer Science & Information Technology
Autofocus cameras automatically adjust the focal length by using a small motor to move the lens in or out
Indicate whether the statement is true or false
Computer Science & Information Technology