To find the second largest element of the given array, first of all, sort the array.
Sorting an array
- Compare the first two elements of the array
- If the first element is greater than the second swap them.
- Then, compare 2nd and 3rd elements if the second element is greater than the 3rd swap them.
- Repeat this till the end of the array.
After sorting an array print the second element from the end of the array.
Shathana. S.R. Answered question
