Computer Science, asked by nikitapriyanka25, 5 months ago

given an array find second largest integer .if there exists no second largest integer, return-1
in c

Answers

Answered by ar6697898
0

Logic to find second largest element

Declare two variables max1 and max2 to store first and second largest elements. Store minimum integer value in both i.e. max1 = max2 = INT_MIN . Iterate though all array elements, run a loop from 0 to size - 1 . Loop structure should look like for(i=0; i<size; i++)

Similar questions