Question: skeleton code for problem 1: For this lab, please only write the required function. Please use the skeleton code is problemn.h and problemn.cpp, where n

 skeleton code for problem 1: For this lab, please only write

skeleton code for problem 1:the required function. Please use the skeleton code is "problemn.h" and "problemn.cpp",

where n is the problem number. For problem 1, we will provide

For this lab, please only write the required function. Please use the skeleton code is "problemn.h" and "problemn.cpp", where n is the problem number. For problem 1, we will provide problem1.h and problem1.cpp with initial function prototypes. Simply fill in the code an submit the final version. If you need to write helper functions, please include them in the "problemn.cpp" file and be sure to add their function prototype to the "problemn.h" file. Problem 1 Given a text txtt0..n-1] and a pattern pat[0.m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat in txtJ. You may assume that n > m. Input: txt[] -"THIS IS A TEST TEXT" Output: Pattern found at index 10 Input: txt[] - "AABAACAADAABAABA" Output: Pattern found at index 0 pat[ "TEST" pat"AABA" Pattern found at index 9 Pattern found at index 12 9 lines (7 sloc) 140 Bytes 1 2 #include "problemi . h.. #include using namespace std; 4 5 void search (char* pat, int M, char* txt, int N) 7 //your code here 5 lines (4 sloc) 90 Bytes 1 #ifndef PROBLEMI 2 #define PROBLEMI 3 void search(char* pat, int M, char* txt, int N); 4 #endif

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!