...TIME and SPACE Complexity:
For a text of length n and substring of length m.
Its best case, time complexity is O(m/2) and in worst case, time complexity is O(n – (m/2) ).
In all the cases best, average and worst its space complexity is O(1).
This algorithm checks two characters at a time.
In best case where the substring is at the start of the text, we can check all the character of substring in only m/2 time.
In worst case where the substring is at the last of the text, we need to iterate till n – m
For more information please visit the following link:-
http://learandexperiment.blogspot.in