Alternating permutation (source code)

= Alternating permutation
{wiki=Alternating_permutation}

An alternating permutation is a specific type of permutation of a set of numbers where the elements alternate between being greater than and less than their neighbors.