Could anyone suggest a means to implement a sliding window over a string to compare it with another string, characterwise?
I've imagined 2 pointers, the distance between them being the window length. Now, there will be a 3rd pointer which will move from the first pointer to the last comparing each charater from the pair of string.Once it reaches the 2nd pointer, the 1stand2nd pointer gets +1 and the 3rd pointer starts again. This process continues until the 2nd pointer reaches the last character of the shorter string.
Is the logic alright? But even if the logic is right, being a newbie to pointer I'm not getting any clue how to implement this in C. My questions are:
1. what will be these pointers? (int???) I only know these will be pointers to characters of each string but have no clue how to denote them
2. how can i increment and compare the 3rd pointer whether it reaches the 2nd one?
3. is pointer at all necessary for implementing my idea?
I'll be obliged if someone can point me to a proper direction.