There was an error while loading. Please reload this page.
1 parent 2a33ab0 commit bf18ab8Copy full SHA for bf18ab8
edit distance.py
@@ -20,6 +20,18 @@
20
#however, given lists start at index zero
21
#our matrix should be (len(a)+1)*(len(b)+1)
22
23
+#there are three different ways to transform a string
24
+#insert, delete and replace
25
+#we can use any of them or combined
26
+#lets take a look at the best case first
27
+#assume string a is string b
28
+#we dont need to do anything
29
+#so 0 steps would be the answer
30
+#for the worst case
31
+#when string a has nothing in common with string b
32
+#we would have to replace the whole string a
33
+#the steps become the maximum step which is max(len(a),len(b))
34
+
35
def edit(a,b):
36
len_a=len(a)
37
len_b=len(b)
0 commit comments