We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1002ea1 commit b6ea707Copy full SHA for b6ea707
src/com/interview/string/Z_Algorithm.py python/string/Z_Algorithm.pysrc/com/interview/string/Z_Algorithm.py renamed to python/string/Z_Algorithm.py
@@ -6,9 +6,6 @@
6
7
#Link to theory: http://www.geeksforgeeks.org/z-algorithm-linear-time-pattern-searching-algorithm/
8
9
-
10
11
12
def z_algo(arr):
13
z = [0 for i in range(len(arr))]
14
left , right = 0 , 0
@@ -48,10 +45,10 @@ def makepattern(string , pattern):
48
45
if z_values[i] == m:
49
46
result.append(i - m - 1)
50
47
print result
51
52
53
54
-string = 'abcdeabcd'
55
-pattern = 'abc'
56
57
-makepattern(string , pattern)
+if __name__ == '__main__':
+ string = 'abcdeabcd'
+ pattern = 'abc'
+ makepattern(string , pattern)
0 commit comments