Question: c++ 1. Write a function that computes the alternating sum of all elements in an array. For example, if alternating_sum is called with an array

1. Write a function that computes the alternating sum of all elements in an array. For example, if alternating_sum is called with an array containing 149 16 9 74 9 11 then it computes 1-4 + 9 - 16 + 9-7 +4-9+ 11 = -2 2. Write a function reverse that reverses the sequence of elements in an array. For example, if reverse is called with an array containing 149 16 9 749 11 then the array is changed to 11 9 4 7 9 16 941 3. Write a function bool equals(int a[], int a_size, int b[], int b_size) that checks whether two arrays have the same elements in the same order. 4. Write a function bool same_set(int a[], int a_size, int b[], int b_size) that checks whether two arrays have the same elements in some order, ignoring duplicates. For example, the two arrays 1 4 9 16 9 7 4 9 11 and 11 11 7 9 16 41 would be considered identical. You will probably need one or more helper functions. 5. Write a function bool same_elements (int a[], int b[], int size) that checks whether two arrays have the same elements in some order, with the same multiplicities. For example, 149 16 9 74 9 11 and 1114 9 16 9 749 would be considered identical, but 149 16 9 74 911 and 11 11 79 16 4 1 49 would not. You will probably need one or more helper functions. 6. Write a function that removes duplicates from an array. For example, if remove_duplicates is called with an array containing 149 16 9 7 4 9 11 then the array is changed to 149 16 7 11 Your function should have a reference parameter for the array size that is updated when removing the duplicates. 7. Write a function that computes the average of the neighbors of a two-dimensional array element in the eight directions shown in Figure 12. double neighbor_average (int values [] [, int row, int column) However, if the element is located at the boundary of the array, only include the neighbors that are in the array. For example, if row and column are both O, there are only three neighbors. 8. Write a function vector int> append(vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
