Find the second maximum number in an array with the smallest complexity


Ask A Question





Login To post a question

Tried to googled it but with no luck.
How can I find the second maximum number in an array with the smallest complexity?

code OR idea will be much help.

I can loop through an array and look for the maximum number
after that, I have the maximum number and then loop the array again to find the second the same way.

But for sure it is not efficient.

For more info please click herehttps://stackoverflow.com/q/14810444



Have a question or need a custom quote?
info@smartinfocare.com