program to find second largest element in an array
Antworten zu Vorstellungsgespräch
Anonym
10. Feb. 2017
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)
Anonym
10. Feb. 2017
public static int findSecondLargestV3(int[] array){
if(array.length == 0 || array.length max){
secondMax = max;
max = array[i];
}
}
return secondMax;
}