Question: You are provided with an array of distinct positive integer numbers. An PC-pair of numbers is (a, b) such that a and b are both

 You are provided with an array of distinct positive integer numbers.

You are provided with an array of distinct positive integer numbers. An PC-pair of numbers is (a, b) such that a and b are both in the array, a is even and b is odd, and b occurs after a in the array. Devise an efficient divide-and-conquer algorithm to compute the number of possible PC-pairs in the given array that is better than simply checking all pairs Your answer must contain the algorithm, a justification for why it works correctly and an analysis in space and time. (Hint: The divide-and-conquer flavor of merge sort may help you.)

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!