Skip to content

Commit bf18ab8

Browse files
authored
Update edit distance.py
1 parent 2a33ab0 commit bf18ab8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

edit distance.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
#however, given lists start at index zero
2121
#our matrix should be (len(a)+1)*(len(b)+1)
2222

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+
2335
def edit(a,b):
2436
len_a=len(a)
2537
len_b=len(b)

0 commit comments

Comments
 (0)