write a java program to find first and second maximum element in array without using sorting
Answers
Answered by
1
Answer:
what are you saying please explain
Answered by
0
Answer:
No need to sort, just iterate through the array, keeping track of the largest value seen so far and the index of that value. var largest = -1; var player = -1; for (var i = 0; i < allPlayers. Length; ++i) { if (allPlayers[i] > largest) { player = i; largest = allPlayers[i]; } } Console.
HOPE THIS WILL HELP YOU....... PLEASE MARK THIS AS BRAINLIEST AND FOLLOW ME.
Similar questions