Approximate pattern matching algorithms