Question: Question 1: Remember that XOR is one or the other but not both. In java the XOR operator is ^ - So a Statement like
Question 1:
Remember that XOR is one or the other but not both. In java the XOR operator is ^ - So a Statement like C = A ^ B would find the XOR or A and B and store it in C. The XOR Truth table is a follows:
| A | B | C (XOR) |
| 0 | 0 | 0 |
| 1 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 1 | 0 |
Write a RECURSIVE called Parity that takes 3 integer arrays of equal size. Each is of the arrays will be composed of 1s and 0s. Your recursive method will return True if the 3rd array contains the XOR of the other 2 arrays.
For example the following would return true:
Array aOne = 1 0 1 1 0
Array aTwo = 0 0 0 1 1
Array aParity = 1 0 1 0 1
Conversely the following array values would yield a false result
Array aOne = 1 0 1 1 0
Array aTwo= 0 0 0 1 1
Array aParity = 1 0 0 1 1
The Method signature for this question will be found in Q1 of the mid1 package.
this is what i have
package mid1;
public class Q1 { /** *Your recursive method will return True if the 3rd array contains the XOR of the other 2 arrays. * @param aOne * @param aTwo * @param aThree */ public static boolean parity(int[]aOne, int[]aTwo, int []aThree) { //Replace the following with appropriate code return false; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
