0

Find max in java array without sorting?

9th Aug 2017, 8:51 AM
saurabh singh
saurabh singh - avatar
4 odpowiedzi
+ 2
Here you go sir I made it as simple as possible https://code.sololearn.com/cwtss3H7Yu3O/?ref=app
9th Aug 2017, 9:12 AM
Recon
Recon - avatar
+ 2
@boris I just wanted it as simple as possible.. Thanx for the note. I didn't put -values in mind
9th Aug 2017, 1:24 PM
Recon
Recon - avatar
0
@Recon, just a little suggestion: if max = 0 at the beginning, it will not work correct, if all values are less than 0. Should be: int max = Integer.MIN_VALUE; And for array of long values: long max = Long.MIN_VALUE;
9th Aug 2017, 1:03 PM
Boris Batinkov
Boris Batinkov - avatar
0
thank you sir
9th Aug 2017, 3:00 PM
saurabh singh
saurabh singh - avatar