def midle_high_sort(x):
x = np.array(sorted(x))
x = np.hstack((x[np.arange(0,len(x),2)],np.flipud(x[np.arange(1,len(x),2)])))
return x
midle_high_sort([3,2,1,6,4,7,4])
array([1, 3, 4, 7, 6, 4, 2])
def midle_high_sort(x):
x = np.array(sorted(x))
x = np.hstack((x[np.arange(0,len(x),2)],np.flipud(x[np.arange(1,len(x),2)])))
return x
midle_high_sort([3,2,1,6,4,7,4])
array([1, 3, 4, 7, 6, 4, 2])