[SOLVED] CS220 Assignment1

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment_1-kafxqc.zip (15.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)

In this your first project you write a function

int common(int A[], int B[], int m, int n)

that takes two arrays A[] and B[] of integers, of length m and n, and reports the number of common elements, not counting multiplicities. So [1,3,1,4,6] and [4,4,2,5,1,5,1,1] have just two common elements.

There are many ways to do this, for this homework you are asked to use this algorithm: you sort the two arrays separately, with mergesort, for which you obtain an auxiliary array with malloc. Then you proceed through both arrays, as in merging, identify common elements. Once you found a common element, you skip in both arrays all repetitions of this element.

  • Assignment_1-kafxqc.zip