Question: Write a code which for a given one - dimensional array A ( vector ) looks for pairs ( p , q ) such that
Write a code which for a given onedimensional array A vector looks for pairs p q such that ApAq is an even number. That is the code should return
a numeric variable telling what is the number of pairs say nn
an array listing the pairs of indices the size of the array should be nn
The code should return nn as the number of pairs, and an empty array of indices if the number of pairs exceeds
For example, given an array A the code should return number of pairs as and then an array ; ; becausethere are exactly three pairs that full the above conditions, namely:
because AA
because AA
because AA
Note that pairs should not be doublecounted, because and is treated as the same pair. Answer in matlab code please.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
