a). The first function, combine_arr(), has two inputs arrays of possibly differe
ID: 3546081 • Letter: A
Question
a). The first function, combine_arr(), has two inputs arrays of possibly different widths (that are already sorted in ascending order) and as output an array which combines the two arrays in ascending order BUT DOES NOT REMOVE DUPLICATES IN THE OUTPUT ARRAY. The function proto-type is:
void combine_arr(int x[], int nx, int y[], int ny, int z[]);
b) The second function, remove_dups(), has as input an array of integers of length n and as output an array of the same length or smaller, but in which all duplicates are removed. Its function proto-type is:
int remove_dups(int z[], int n, int a[]);
c) You may assume that the input arrays are limited to 10 integer numbers and the output arrays are therefore limited to 20.
d) For simplicity, initialize the input arrays in main() when you declare them.
e)Display the results after each function call on the screen (back in main()).
f) Below are two sample runs:
double x[] = {-1, 6, 14, 19, 32}; // declared in main
double y[] = (-1, 16, 18, 32, 55, 99}; // declared in main
z[] = -1 -1 6 14 16 18 19 32 32 55 99 // appears on screen
a[] = -1 6 14 16 18 19 32 55 99 // appears on screen
double x[] = {-1, 0, 14, 19, 32, 44, 59}; // declared in main
double y[] = (0, 14, 14, 16, 59}; // declared in main
z[] = -1 0 0 14 14 14 16 19 32 44 59 59 // appears on screen
a[] = -1 0 14 16 19 32 44 59 // appears on screen
Explanation / Answer
a). The first function, combine_arr(), has two inputs arrays of possibly differe
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.