Write a program to find the second largest number in an array. Given an unsorted array, we have to write a code to find the second largest number in an array. Also, we need to focus on time complexity. As the time complexity of an algorithm is very important in terms of an interview.

For example – Let’s take an array.

**Input** – arr[] = { 4, 1, 5, 2, 8, 0, 3, 55}

**Output** – 8

The second largest element in this array is 8. Think for a moment, how do you find the second largest number in an array? There are multiple ways to solve this problem. Which approach you prefer and why?

In this tutorial, we cover following things –

- How to find the second largest number in an array using sorting.
- C program to find the second largest number in an array.
- C++ program to find the second largest number in an array.
- PHP code to find the second largest number in an array.
- →

1Comment