edit algorithm for mindiff