Given an array Arr (distinct elements) of size N. Rearrange the elements of array in zig-zag fashion. The converted array should be in form a < b > c < d > e < f. The relative order of elements is same in the output i.e you have to iterate on the original array only.
You don't need to read input or print anything. Your task is to complete the function zigZag() which takes the array of integers arr and nas parameters and returns void. You need to modify the array itself.
Expected Time Complexity: O(N) Expected Auxiliary Space: O(1)