first = second = third = -∞
a) Let current array element be x.
b) If (x > first)
{
// This order of assignment is important
third = second
second = first
first = x
}
c) Else if (x > second)
{
third = second
second = x
}
d) Else if (x > third)
{
third = x
}
Please Let me know if you have any queries, will be happy to help 😇