Question: WRITE A recursive function to perform the task: 1) // Pre: v is a vector of integers start is a position in v // Post:

WRITE A recursive function to perform the task:

WRITE A recursive function to perform the task: 1) // Pre: vis a vector of integers start is a position in v //

1) // Pre: v is a vector of integers start is a position in v // Post: returns the position of the smallest element in v from // v[start] to v[v.size()-1] int Select_Smallest (const vector& v, int start); 2) // Pre: v is a vector of integers // Key is any integer // start is a position in v // Post: returns the position of the first element in v from // v[start] // to the end equal to key. If no element is equal, // returns -1 int Sequential_Search (const vector& v, int key, int start); 3) // Pre: "V" is a vector of integers // "key" is any integer // "start" is a position in v // Post: Returns the number of elements from v[start] to v[v.size()-1] that are equal to "key" int Count_Matches (const vector& v, int key, int start); 4) // Pre: "S" is any string // Post: returns a string consisting of just the capital letters in s string Extract_Capitals (const string& s); (over) 5) // Pre: "S" is any string // Post: returns true if s is the same backwards and forwards, false // otherwise. bool Is Palindrome (const string& s); You should be doing this in a straightforward step by step way- no cheating by using built in member functions to do the job. So, yes, I know you can do, say, the palindrome function in one line using the "reverse function. Don't- do it with loops and recursion. You should usually have one call per element (character in a string, element in a vector, that sort of thing) Note, by the way, my use of preconditions and postconditions to describe what a function expects, and what it does. You should have similar comments for your functions (they don't have to explicitly be in this format, but you should be stating what you assume about your parameters, and what you return)

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!