Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Earlier in the semester, you wrote an iterative version of find called indexOf(). Now, write a recursive version. The function takes two string parameters, s1
Earlier in the semester, you wrote an iterative version of find called indexOf(). Now, write a recursive version. The function takes two string parameters, s1 and s2 and returns the starting index of s2 inside the first string sl, or -1 if s2 is not found in sl. You must not use any loops; you also cannot use the string member functions find or rfind. You may use the member functions size, at and substr. Your function must be recursive. Complete the following file: IndexOf.cpp 1 #include 2 using namespace std; 3 4 int indexOf(const string& si, const string& s2) 5 { 6 7 8 9 10 } OOOO
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started