Write a C function that takes as arguments three integer arrays,A,B, and Calong with integers m,nindicating the number o
Posted: Fri May 20, 2022 6:20 pm
Write a C function that takes as arguments three integer
arrays,A,B, and Calong with integers m,nindicating the number of
elements in AandB, respectively. The arrays A is assumed to be
sorted in ascending order andBis assumed to be sorted in descending
order. You arerequired to store inCall elements that are present in
both A and B, in ascending order. You may assume that A and B
individually may have duplicate elements within them. In the
result,there should not be any duplicates inC. The function should
return the number of elements in C . For example, if
A={8,8,12,12,15,67} and B={88,67,67,45,15,12,12,9,1}withm= 6,n= 9,
the resulting C should be{12,15,67}and 3 should be returned. Do not
use any additional arrays or any library functions other than
standard input and output. Write only the required function. No
need to write the main function.
arrays,A,B, and Calong with integers m,nindicating the number of
elements in AandB, respectively. The arrays A is assumed to be
sorted in ascending order andBis assumed to be sorted in descending
order. You arerequired to store inCall elements that are present in
both A and B, in ascending order. You may assume that A and B
individually may have duplicate elements within them. In the
result,there should not be any duplicates inC. The function should
return the number of elements in C . For example, if
A={8,8,12,12,15,67} and B={88,67,67,45,15,12,12,9,1}withm= 6,n= 9,
the resulting C should be{12,15,67}and 3 should be returned. Do not
use any additional arrays or any library functions other than
standard input and output. Write only the required function. No
need to write the main function.