-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/36/levenshtein #32
Conversation
* \param b Integer | ||
* \return Integer the lower value between the two given Integers | ||
*/ | ||
int min(int a, int b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peux tu l'appeller minInt ?
int last_cost = i + 1; | ||
for (size_t j = 0; j < size2; j++) { | ||
int sub_cost = (str1[i] == str2[j]) ? 0 : 1; | ||
int cost = min(min(last_cost + 1, val[j + 1] + 1), val[j] + sub_cost); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trop long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple mais efficace.
* \return Integer the distance between the two given strings | ||
*/ | ||
int levenshtein(char *str1, char *str2) { | ||
if (strcmp(str1, str2) == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il serait peut-être mieux d'utiliser strcasecmp
pour ne pas être sensible à la case ?
9e2e92c
to
be9a7a3
Compare
Leveinshtein