Question: An array is defined to be twin paired if its even valued elements are in ascending order and its odd-valued elements(if any) are in ascending

An array is defined to be twin paired if its even valued elements are in ascending order and its odd-valued elements(if any) are in ascending order. The array {-6, 12,1,24,4,5} is twin aired because the even-valued element (-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 twin paired because the odd numbers are not in ascending order. Write a function named is TwinPaired that returns 1if its array argument is twin paired, otherwise it should return 0. Other twin paired arrays include {2,2,2,1,1,1}

{2,4,3,2}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!