Write a program to find second largest no in given array.
How about sorting the array and move 2 indices from the last item and get the value. This way, we can extend the solution to finding the k-th largest element in an array.
In an unsorted array whenever you set the largest number during iteration, you set second largest number to previous largest number.
Oct. 12, 2015