Question: provide explaination as well Write an algorithm, NotHereAndThere(int[] A, int[] B), that takes as input two integer arrays, array A of size n and array

 provide explaination as well Write an algorithm, NotHereAndThere(int[] A, int[] B),

provide explaination as well

Write an algorithm, NotHereAndThere(int[] A, int[] B), that takes as input two integer arrays, array A of size n and array B of size m. Both arrays A and B store integer numbers that are in increasing orders that may or may not be the same. You can assume that both arrays A and B has no repeating numbers, but the numbers that appear in A may appear in B and vice versa. Your algorithm should print all the numbers that are not in array A and not in Array B, count the total number of elements of array A that do not occur in array B plus the number of elements of array B that do not occur in array A and print the total count. For example, if array A = {3,4,7,9,11} and array B = {1,4,6, 7, 11}, your algorithm should return 4 as the total number of elements that are not in array A and array B, and the numbers are 1,3,6,9. The runtime complexity of your algorithm should be in the order of n + m, that is, 0(n + m). Note: You are not allowed to declare a third array, but you are allowed to declare any necessary counters (variables.)

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!