Write an application which includes and algorithm that takes an array, selects the high and low integer from the array of integers with each pass and builds a new array of integers by inserting the high and low selection with each pass. Your output should show the original array of integers and the output of each pass on a new line.
Note: You can assume all integers are positive, but your code must work for an even and odd number of integers.
Example Output:
Input Array: [ 42 , 24, 7, 13, 36, 52]
Pass 1: [7, 52]
Pass 2: [7, 13, 42, 52]
Pass 3: [7, 13, 24, 36, 42, 52]