I m looking for a sorting algorithm tolerant to errors.
Suppose I have a list A and a list B with some spelling errors. Here zanana instead of banana:
A = ["raspberry","apple", "banana", "peach"]
B = ["raspberry","apple", "zanana", "peach"]
I would like a Sort function, which returns the same new list C using A or B as input.
Sort(A) = C
Sort(B) = C
For instance:
C = [3,2,1,0]
If I use a classical lexicographic order, I would not have the same result because zanana and banana would have different index.
I'm trying to think whether I can use a hamming distance or something like that, but without success.
Note: This is a toy example. In real example, instead of fruits, I have long string of differents sizes. Instead of banana and zanana, i have :
- 4df7e8ea5e6ee731ec4877a99fffc8da
- 5df7e8ea5e6ee731ec4877a99fffc8da