-
-
Save dnbaker/04ea2249bd16b734b2c7fbd904cff341 to your computer and use it in GitHub Desktop.
Hamming distance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Assumes that both strings are of equal length. | |
* | |
*/ | |
int hd(char *a, char *b) { | |
int ret = 0; | |
while(*a) ret += (*a++ != *b++); | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment