Given a sorted array, rearrange  the array alternately i.e first element should be max value, second min value, third second max | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
- 1

Given a sorted array, rearrange  the array alternately i.e first element should be max value, second min value, third second max

Given a sorted array, rearrange  the array alternately i.e first element should be max value, second min value, third second max, fourth second min and so on. Eg: arr[] = {1, 2, 3, 4, 5, 6, 7} O/P: {7, 1, 6, 2, 5, 3, 4} comment the code

4th Aug 2018, 10:09 AM
Raja N
Raja N - avatar
1 Respuesta
4th Aug 2018, 10:13 PM
Louie
Louie  - avatar