The complexity of your algorithm is O(nm).
Algorithmic complexity is a measure of how long an algorithm would take to complete given an input of size n. If an algorithm has to scale, it should compute the result within a finite and practical time bound even for large values of n. For this reason, complexity is calculated asymptotically as n approaches infinity.
Now,
Text: T
Pattern: s
Algorithm String Matching(T,s)
n=len(T)
m=len(s)
for i = 0 to n-m
j=0
while j<m and s[j]=T[ i + j]
j=j+1
if j==m
return i
end if
end while
return -1
end for
the complexity of your algorithm: O(nm)
reason: nested loop runs one run (n-m) times and second run m times. so it becomes (n-m)(m) = (nm-m2) = O(nm)
To know more about "Complexity algorithm":
brainly.com/question/20709229
#SPJ4