Question: language is in C Exercise 3.28. Implement the following specification: 3.2. Strings am 11/* Returns whether str contains an instance of substr. 2 * Returns

 language is in C Exercise 3.28. Implement the following specification: 3.2.

language is in C

Exercise 3.28. Implement the following specification: 3.2. Strings am 11/* Returns whether str contains an instance of substr. 2 * Returns 0 if either str or substr is NULL or substr is * not in str; returns 1 if substr is in str. 4 */ 5 int has Substring (char * str, char * substr); For example, hasSubstring("Hello universe!", "verse") should return 1. Use the following main function to test your code: BODOV AWN #include 2 int main() { assert (has Substring ("Hello universe!", "10")); assert (has Substring ("Hello universe!", "verse")); ssert (has Substring ("Hello universe!", "")); assert (has Substring("","")); assert (!has Substring ("Hello universe!", "verses")); assert (!has Substring("Hello universe !", "loun")); assert (!has Substring("Hello universe !", "erse!!")); return 0; This exercise hints at the depth of the subject of computation. While the straightforward implementation is what is intended here, the interested reader should investigate the Knuth-Morris-Pratt, or KMP, 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!