program to find second largest element in an array
Anonymous
public static int findSecondLargestV3(int[] array){ if(array.length == 0 || array.length max){ secondMax = max; max = array[i]; } } return secondMax; } Complexity of this algorithm is O(n)
Check out your Company Bowl for anonymous work chats.