Question: Write a function int findmiddle(vector &vecs, int &p) where vecs is the set of vectors p is the found middle value and returns 1 and

Write a function

int findmiddle(vector> &vecs, int &p)

where vecs is the set of vectors p is the found middle value and returns 1 and assigns the found middle value to p if the sum of lengths S is odd, otherwise returns 0 and p is ignored.

File you must submit: soln_func.cc

Examples:

vecs:[ [1 2] [3 4] [4 5] ] even number of elements
vecs:[ ] even number of elements
vecs:[ [1] ] middle 1 
vecs:[ [] [] [1] [] ] middle 1
vecs:[ [1 4 7] [2 5 8] [3 6 9] ] middle 5
vecs: [ [100 101] [1 1 1 1] [200 201 203] ] middle 100

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!