Suppose we have an array{ 1 5 4 3}

If two element of is not in zigzag arrangement then swap them otherwise Not need

Here 1st and 2nd are already in zigzag arrangement so no need to swap.

Now suppose current position is a[2] then swap a[2] and a[3]

So array will be {1 5 3 4}