This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KMP: | |
def partial(self, pattern): | |
""" Calculate partial match table: String -> [Int]""" | |
ret = [0] | |
for i in range(1, len(pattern)): | |
j = ret[i - 1] | |
while j > 0 and pattern[j] != pattern[i]: | |
j = ret[j - 1] | |
ret.append(j + 1 if pattern[j] == pattern[i] else j) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
co = checkout | |
cob = checkout -b | |
coo = !git fetch && git checkout | |
br = branch | |
brd = branch -d | |
brD = branch -D | |
merged = branch --merged | |
dmerged = "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" | |
st = status |