An array is defined to be double sorted if its even-valued elements (if any) are in ascending order and its odd-valued elements (if any) are in ascending order.

The array {-6, 12, 1, 24, 3, 5} is double sorted because the even-valued elements (-6, 12, 24) are in ascending order and so are the odd-valued elements (1, 3, 5). However, the array {3, 2, 1} is not double sorted because the odd numbers are not in ascending order.

Write a function named isDoubleSorted that returns 1 if its array argument is double sorted, otherwise it returns 0.

If you are programming in Java or C#, the function signature is

int isDoubleSorted(int[ ] a)

If you are programming in C or C++, the function signature is

int isDoubleSorted(int a[ ], int len) where len is the number of elements in a.

Other double sorted arrays include:

{2, 4, 32},

{2, 2, 2, 1, 1, 1},

{1, 19, 23},

{1, 2},

{2, 1},

{8},

{17},

{ }

please help me out with this question