I came across this question in an interview:
Given the two regular expressions, calculate the editing distance between them. The edit distance is defined as the smallest edit distance between any two lines generated by two regular expressions, respectively.
Formally, we look for d(L1,L2) = min { d(x,y) | x from L1, y from L2 } d(L1,L2) = min { d(x,y) | x from L1, y from L2 } , where L1 and L2 are the languages โโgenerated by two regular expressions.
I could not solve it during the interviews. Even now I do not know how to solve this. Any ideas?
I think this is the same as http://www.spoj.com/problems/AMR10B/
string algorithm regex dynamic-programming
Quixotic
source share