Question: Exercise 1: Finding the maximum value (10 points) Provide an implementation of the maximum function whose declaration is shown below. The only argument of the

 Exercise 1: Finding the maximum value (10 points) Provide an implementation

Exercise 1: Finding the maximum value (10 points) Provide an implementation of the maximum function whose declaration is shown below. The only argument of the function is a vector v of int. The function returns the largest int that is in the vector v. vector & v) Exercise 2: Appending vectors (10 points) Provide an implementation of the appendVector function whose declaration is shown below Both arguments of the function are vectors of int. The function should modify vector v by appending to it all the elements of w. For example, if v = (4, 2, 5) and w (1 1, 3), then v will become (4, 2, 5,11, 3) as a result of calling the function. Hint: the vector class has a functiorn called push back that appends values passed into it. Exercise 4: Prime factors (10 points) Implement a function that takes an integer as its sole argument and returns a vector containing the prime factors of that number. For example, if you pass in 100, then function returns the vector (2, 2, 5, 5). The function signature should look like the following. vector Exercise 5: Vector insertion (10 points) Suppose a vector v contains a sequence of integers ordered from lowest to highest. For example, v might contain the values 3, 6, 7,12. Write a function called insert that takes this vector v as a first argument and an integer k as the second argument. The function inserts k into the vector so that it preserves the order of elements. For example, if v were (3, 6,7, 12) and k were 5, then after calling the function, v would be (3, 5, 6,7, 12). In your implementation of insert, do not use the insert function of the vector class (v.insert

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!