Update Edit Distance Algorithm