Question: ( 1 ) ( 6 marks ) Consider a variation of the brute - force string matching problem. Given a text string p , we
marks Consider a variation of the bruteforce string matching problem. Given a
text string p we try to find a longest substring whose length L in p that matches with
the first characters of a pattern string t
For instance, let p "I have an int variable in my program". If L and t "variable",
then of course we can find that the whole pattern t appears in p
If L and t "integer", we can only find that substring "int" should be returned, since
it satisfies the minimum length L and matches the first characters in t
If L and t "another", we cannot find any substring that satisfies the conditions.
Though an in p matches the first characters of t but its length L
Design a bruteforce algorithm to solve the problem. If there are many substrings that
satisfy the conditions, report all of them.
do it in c
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
