Hi , for this wave sort question if the input array is
int a[]={1,3,4,2,7,8};
so can the output be
3 1 4 2 8 7
I have used the logic of even index value should be greater than the odd index value. if not i am swapping it
Please refer to the following code: