Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
write a recursive version. The function takes two string parameters, s1 and s2 and returns the starting index of s2 inside the first string s1, or -1 if s2 is not found in s1.
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.
CANNOT MODIFY GRAY AREA
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Objectives Practice defining functions with parameters. Practice manipulating strings. Implement your own version of Python string methods The provided file string_functions.py defines several string functions, but does not include the code for them. Add code to implement functions that are equivalent in behavior to the corresponding built-in Python string function. Every function MUST return a value. Use loops to implement your functions. You cannot use built-in string methods, string functions, or string-operators to implement your functions. Each function is worth a maximum of 10 points. 1. cs110_upper: Takes a string as a parameter and returns it as a string in all uppercase. Hint: Use the ord () function to get the ASCI value of a character. For example, ord ('a') returns the integer 97. You will also need to use the chr (value) function that returns a string of one character whose ASCII code is the integer valus. For example, chr (97) returns the string 'a'. You cannot use the…arrow_forwardProblem Statement: The mathematician Conway imagined a game, called game of life, which considered cells that are susceptible to reproduce, disappear, or survive when they obey certain rules. These cells are represented by elements on a grid of squares, where a grid has an arbitrary size. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squares that contain other cells. The rules are stated as follows: 1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation. Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation. Write a program that simulates this game and displays all successive…arrow_forwardDefine Arrays as Parameters to Functions.arrow_forward
- ] ] has_perfect You are to write a function has "perfect (graph)" that takes in a BIPARTITE graph as its input, and then determintes whether or not the graph has a perfect matching. In other words, it will return the Boolean value True if it has one, and False if it does not. After compiling the above cell, you should be able to compile the following cell and obtain the desired outputs. print (has perfect({"A" : ["B", "C"], "B" : ["A", "D"], "C" : ["A", "D"], "D" : ["B", "C"]}), has perfect ( {"A" : ["B"], "B" : ["A", "D", "E"], "C" : ["E"], "D":["B"], "E": ["B","C","F"], "F":["E"]})) This should return True False Python Pythonarrow_forwardConsider the function void modify(int & x) { x = 10; }Show how to call the modify function so that it sets the integer int i;to 10.arrow_forward1 def all_fluffy(s: str) -> bool: 2 """Return True iff every letter in s is fluffy. Fluffy letters are those 3. that appear in the word 'fluffy'. 4 #TODO: Add at least one example to the docstring and complete the body 7 8 9 10 #TODO: Now complete the function bodyarrow_forward
- The function ver() is defined as follows: void ver(char "pc) { char c; if( "pc == "\O' ) return; c = "pc; ++pc; ver(pc); putchar(c); Show the output when function ver() is called as follows: ver("recursion");arrow_forwardC++arrow_forwardWhen the following program is executed, it terminates with an error. Which option best describes the cause of this error? Question options: The function will terminate the program due to the recursive limit being reached. The function will terminate the program due to a type mismatch when evaluating an operator. The function will terminate the program due to invalid syntax. The function will terminate the program due to an invalid type conversion. The function will terminate the program due to it accessing an invalid list index. None of these optionsarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education