Professional Documents
Culture Documents
Assignment 03
, 2020
Question 01:
Brute Force:
Output:
TEXT FILE:
Form Execution:
Case A:
CASE B:
CASE C:
CASE D:
No output message because string is not matched since case is checked and there
is no “ Is “ word in the file.
Output shown because string is matched since case is checked and
there is a “ This “ word in the file.
KMP:
Output:
Question 02:
ORDERLESS:
In brute force, Comparison can be done in any order.
OTHER PROS OF BRUTE FORCE:
o Wide applicability.
o Simplicity.
o It produces reasonable algorithms for some important problems such as
a) searching
b) string matching
c) matrix multiplication
o It produces standard algorithms for simple computational tasks such as
a) sum/product of numbers
b) finding max/min in a list
o Brute Force Algorithms refers to a style that does not include any shortcuts to
improve performance, but instead relies on thorough computing power to try all
possibilities until the solution to a problem is found. Because “Sometimes doing
better is not worth bother.”
PLAGIARISM DETECTION:
Robin-Karp algorithm is good when searching for large text that can find many patterns,
such as plagiarism detection. Meanwhile, KMP is good for searching within small
alphabets like in Bioinformatics or searching in binary strings but if the alphabet goes
up, it is less efficient.
FINGERPRINT SEARCH:
Rabin-Karp substring search is known as a fingerprint search because it uses a small
amount of information to represent a (potentially very large) pattern. Then it looks for
this fingerprint (the hash value) in the text. The algorithm is efficient because the
fingerprints can be efficiently computed and compared.
2D PATTERN:
Robin-Karp algorithm is more efficient in detection of 2D patterns than rest of the
algorithms.