+ 1

Sorting an array in waveform.

How to sort array in waveform ( array[0]>=array[1] <=array[2] >=array[3] ..) in most effecient way? Here is what I did and so I wanna know if this is the most efficient way to do it or not .Ty ! https://code.sololearn.com/c6l3pVydmbOS/?ref=app

29th Jan 2021, 2:45 PM
Abhay
Abhay - avatar
2 Answers
+ 3
From what I see, this solution have time complexity of O(n) and uses O(1) auxiliary space which is fairly efficient according to me.
29th Jan 2021, 2:57 PM
Arsenic
Arsenic - avatar
+ 1
29th Jan 2021, 3:08 PM
Abhay
Abhay - avatar