how to find out the maximum and the second maximum number from an array of integers
andy_i 0 Newbie Poster
Recommended Answers
Jump to Post>how to find out the maximum and the second maximum number from an array of integers
You sort them out in ascending order and then you pick the last two.
Jump to Post>how to find out the maximum and the second maximum number from an array of integers
You sort them out in ascending order and then you pick the last two.
Use a heap ^_^ to store the top two elements as you walk through the array. Then finding the top …
All 7 Replies
Aia 1,977 Nearly a Posting Maven
andy_i 0 Newbie Poster
Aia 1,977 Nearly a Posting Maven
Chaster 2 Junior Poster in Training
praneeth_gunda 2 Newbie Poster
Aia 1,977 Nearly a Posting Maven
Rashakil Fol 978 Super Senior Demiposter Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.