Say we have string a = "abc" string b = "abcdcabaabccbaa"
Find location of all permutations of a in b. I am trying to find an effective algorithm for this.
sort string a // O(a loga) for windows of length a in b // O(b)? sort that window of b // O(~a loga)? compare to a if equal save the index
So would this be a correct algorithm? Run time would be around O(aloga + ba loga) ~= O(a loga b)? How efficient would this be? Possibly way to reduce to O(a*b) or better?