An array of integers is defined as being in meandering order when the first two elements are the respective largest and smallest elements in the array and the subsequent elements alternate between its next largest and next smallest elements. In other words, the elements are in order of [first_largest, first_smallest, second_largest, second_smallest, ...].
Example
The array [5, 2, 7, 8, -2, 25, 25] sorted normally is [-2, 2, 5, 7, 8, 25, 25]. Sorted in meandering order, it becomes [25, -2, 25, 2, 8, 5, 7]
Function Description
The function takes one parameter, unsorted[n]: the unsorted array