Assignment 1 - Beginning Java Data Structures and Algorithms - SRWTHWC
Assignment 1 - Beginning Java Data Structures and Algorithms - SRWTHWC
➢ The Scenario: You are a detective investigating a case where a hidden message is embedded
within a seemingly ordinary text file. This message could be crucial evidence!
➢ The Evidence: You will be provided with two files:
• innocent_text.txt: This file contains the text with the hidden message.
• message_to_find.txt: This file contains the hidden message you need to locate.
1. Naive Search:
2. Boyer-Moore Algorithm:
➢ Objective: Explore and choose one additional String Matching Algorithm besides Naive
Search and Boyer-Moore (e.g., Knuth-Morris-Pratt (KMP), Rabin-Karp).
➢ Guidance: Research and understand the chosen algorithm's core concept and how it differs
from Naive Search and Boyer-Moore. Resources like online tutorials or textbooks can be
helpful.
➢ Task:
• Briefly explain the chosen algorithm's working principle compared to the algorithms you
already explored.
• Implement your chosen algorithm in Java.
• Analyze the innocent_text.txt file using your chosen algorithm.
• Compare the time complexity of all three algorithms.
➢ Objective: Based on the results from your String Matching Algorithms, identify the hidden
message within the text file.
➢ Task:
• Analyze the outputs from each algorithm.
• Identify the location of the hidden message within the text file.
• Write a report summarizing your findings:
o Explain how each algorithm identified the hidden message (or why it failed).
o Identify the most efficient algorithm for this specific case and explain your
reasoning.
o Mention any challenges you faced during the implementation.
Learning Outcomes:
This assignment provides a structured approach to learning String Matching Algorithms while
offering real-world application through the detective theme.