Consider an array (for example (1 3 2 4 6 12))of even number of elements like 2,4 or any number which is even . Need to arrange array in below order.First maximum First Minimum Second Max Second Min Third Max Third Min…. I have divided code into 4 parts.## Arrange elements in Descending order and create a blank array newlist of same length with value 0## arr=(1 3 2 4 6 12)len=${#arr[@]}k=0newlist=()lngthminusone=$(( $len -1))echo $lngthminusonewhile [ $k -lt $len ]doi=0value=0newlist+=$valuewhile [ $i -lt $lngthminusone ]doj=$(( $i + 1))if [ ${arr[i]}…