Skip to content

Latest commit

 

History

History
17 lines (12 loc) · 394 Bytes

README.md

File metadata and controls

17 lines (12 loc) · 394 Bytes

Alternative array sorting

Given an array of integers, print the array in alternating min/max order. The first element should be the first maximum, second element should be the first minimum, third element should be second maximum, etc.

For example, given the following array:

arr[] = [10, 2, 11, 3, 7, 4, 1]

Your function should return:

11, 1, 10, 2, 7, 3, 4