Question: Write a C function int find_pattern(char *s, char * pattern) to find a pattern within a string. 1. The function should return the first position

Write a C function int find_pattern(char *s, char * pattern) to find a pattern within a string.

1. The function should return the first position of the pattern in the string or -1 if the pattern is not found.

2. What is the Big O of your functions algorithm based on the size of the pattern and the string?

3. What would be a worst-case pattern and string for your functions algorithm?

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!