Guys a new some help in my Sequential Search.
ill explain with an example. since i feel it is easier for me to explain
let assume ive got
user input: Graphics
Pattern: is defined as
Sentence in file: Graphics is purely defined as a field in Computer Science
1)u.input = Graphics = first token of the sentence (Sentence_token)
2)pattern_token = "is" = Sentence_token
3)pattern_token = "defined" NOTEQUALTO "purely"= Sentence_token
therefore,Pattern_token (remains same we dont get the next token) = "defined" BUT Sentence_token = "defined"
4)pattern_token = "as" = Sentence_token
5) print Sentence.
take the input from the user and compare it with SENTENCE
if found than we take the secound token from the SENTENCE and compare it with the first token in the PATTERN
if equal than get the next token of the PAttern and next token of the SENTENCE and compare again. continue till we reach have no more tokens.
else if the token from the PATTERN does not match the token from the SENTENCE than only get the next token for the SENTENCE while keeping the old token of the PATTERN and compare again.
note this is not a Strict sequential search in other words its not nesscary that all the Patterns such as (is defined as) have to come after one another with no words in between.
Hope i made things clear..i written a code but it doesnt work properly..
can anyone help me ..