





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solutions to various string matching problems using the Brute Force Algorithm. Each problem involves finding a specific pattern in a given text. The algorithm is demonstrated step-by-step, with the number of comparisons required to find the pattern indicated. The document concludes with the total number of comparisons made for each problem.
Typology: Study notes
1 / 9
This page cannot be seen from the preview
Don't miss anything!






string matching problem 1: pattern: dove text: THEQUICKBROWNFOXJUMPDOVERTHELAZYDOG STEP1: THEQUICKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP2: THEQUICKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP3: THEQUICKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP4: THEQUICKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP5: THEQUICKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP6: THEQUICKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP7: THEQUICKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP9: THEQUCKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE
xxxx DOVE STEP19: THEQUCKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP20: THEQUCKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP21: THEQUCKBROWNFOXJUMPDOVERTHELAZYDOG xxxx DOVE STEP22: THEQUCKBROWNFOXJUMPDOVERTHELAZYDOG ==== DOVE Answer: The searching ends at index 21 and it talks comparisons to find right correct pattern Problem 2: Pattern: Text Step1: 10100011011001010111011 xxxx 11001010
Step2: 10100011011001010111011 xxxx 11001010 Step3: 10100011011001010111011 xxxx 11001010 Step4: 10100011011001010111011 xxxx 11001010 Step6: 10100011011001010111011 xxxx 11001010 Step7: 10100011011001010111011 xxxx 11001010 Step8: 10100011011001010111011 xxxx 11001010 Step9: 10100011011001010111011 xxxx 11001010 Step10: 10100011011001010111011 ==== 11001010 Answer: The searching ends at index9 and it talks 10 comparisons to find the Correct answer
Step9: BlieveInYourselfAndAllThatYourAre xxxx All Step10: BlieveInYourselfAndAllThatYourAre xxxx All Step11: BlieveInYourselfAndAllThatYourAre xxxx All Step12: BlieveInYourselfAndAllThatYourAre xxxx All Step13: BlieveInYourselfAndAllThatYourAre xxxx All Step14: BlieveInYourselfAndAllThatYourAre xxxx All Step14: BlieveInYourselfAndAllThatYourAre xxxx All Step15: BlieveInYourselfAndAllThatYourAre xxxx All Step16: BlieveInYourselfAndAllThatYourAre xxxx All
Step17: BlieveInYourselfAndAllThatYourAre xxxx All Step18: BlieveInYourselfAndAllThatYourAre xxxx All Step19: BlieveInYourselfAndAllThatYourAre xxxx All Step20: BlieveInYourselfAndAllThatYourAre xxxx All Answer: The searching ends at index 19 and it takes20 comparisons to find the correct pattern Brute Force Algorithm ANSWER D – A – B – C - D D – B – C – A - D D – C – A – B - D D – C – B – A - D D – A – C – B - D D – B – A – C - D 20 +18+25+23= 24+25+28+20= 23+28+18+24= 23+25+18+20= 20+28+18+20=