COSC 348: Lab03

Exact string search

Task: Implement the naive brute force string search. The idea of brute force string search is to slide a window of the length of a pattern (Pat) over the text (Txt) from left to right one letter at a time. Within the window compare successive characters from left to right.

Reference: Brute force algorithm

Question: how many times the following pattern occurs in the text?

Pat: GCAGAGAG
Txt: GCATCGCAGAGAGTATACAGTACGGCATCGCAGAGAGTATACAGTAC

IMPORTANT: Submit the code you've developed and answer the question (worth 1% of the final mark).


Cosc348 home
Cosc348 labs