+ 1

Digit before maximal digit

please help me to find second maximal digit in array

23rd Feb 2018, 3:48 PM
Ismayilov Majid
Ismayilov Majid - avatar
7 ответов
+ 3
go with quick or merge or shell or even heap short... if data is bigger... they have their own importance upon specific problems too...
23rd Feb 2018, 4:23 PM
sayan chandra
sayan chandra - avatar
+ 2
thanks i will try
23rd Feb 2018, 4:25 PM
Ismayilov Majid
Ismayilov Majid - avatar
+ 1
sort it in desending order.... array[1] is your ans
23rd Feb 2018, 4:05 PM
sayan chandra
sayan chandra - avatar
+ 1
int arr[]= {4,5,3,2,8}
23rd Feb 2018, 4:13 PM
Ismayilov Majid
Ismayilov Majid - avatar
+ 1
@jan u need to sort anyway to find the max... there are over 40 types of sorting algo... if data is big so is complexity..thats normal without sorting u cant proceed...
23rd Feb 2018, 4:20 PM
sayan chandra
sayan chandra - avatar
+ 1
in python...the min() max() function use 'quick sort' behind the bars
23rd Feb 2018, 4:24 PM
sayan chandra
sayan chandra - avatar
0
not so big ...for examplee 5 elements
23rd Feb 2018, 4:12 PM
Ismayilov Majid
Ismayilov Majid - avatar