1)

Median Function

In statistics, when a set of values is stored in ascending or descending order, its median is the middle value. If the set contains an even number of values, the median is the mean, or average, of the two middle values.

Write a function that accepts as arguments the following:

a) A vector of integers

b) An integer that indicates the number of elements in the vector

The function should determine the median of the vector. This value should be returned as a double. (Assume the values in the vector are already sorted)

2)

Mode Function

In statistics, the mode is a set of values in the value that occurs most often or with the greatest frequency.

Write a function that accepts as arguments the following:

A) A vector of integers

B) An integer that indicates the number of elements in the vector

The function should determine the mode of the vector. That is, it should determine which value in the vector occurs most often. The mode is the value the function should return. If the vector has no mode (none of the values occur more than once), the function should return -1. (Assume the vector will always contain nonnegative values).

**Subject Computer Science C-Family Programming**