Using Python, how would you implement a brute-force string matching algorithm. The algorithm would solve the string matching problem. The string matching problem is to find a pattern (string of m characters) inside a text (a string of n characters). Verify your code with outputs from the following test cases:
Test case#1: Text: 10110100110010111 Pattern: 001011
Test case#2: Text: It is never too late to have a happy childhood Pattern: happier
Test case#3: Text: NOBODY_NOTICED_HIM
Aucun commentaire:
Enregistrer un commentaire