def _kmp_search_all(self, pInput_sequence, pPattern):
                """use KMP algorithm to search all occurrence in the input_sequence of the pattern. both arguments are integer arrays. return a list of the positions of the occurences if found; otherwise, []."""
                r = []
                input_sequence, pattern = [len(bin(e)) for e in pInput_sequence], [len(bin(e)) for e in pPattern]
                n, m = len(input_sequence), len(pattern)
                d = p = 0
                next = self._kmp_construct_next(pattern)
                while d < n:
                        p = next[input_sequence[d]][p]
                        d += 1
                        if p == m:
                                r.append(d - m)
                                p = 0
                return r
def _kmp_search_all ( self , pInput_sequence , pPattern ) : r = [ ] input_sequence , pattern = [ len ( bin ( e ) ) for e in pInput_sequence ] , [ len ( bin ( e ) ) for e in pPattern ] n , m = len ( input_sequence ) , len ( pattern ) d = p = 0 next = self . _kmp_construct_next ( pattern ) while d < n : p = next [ input_sequence [ d ] ] [ p ] d += 1 if p == m : r . append ( d - m ) p = 0 return r
use KMP algorithm to search all occurrence in the input_sequence of the pattern. both arguments are integer arrays. return a list of the positions of the occurences if found; otherwise, [].