Apr 4, 2012 at 2:37pm UTC
Hi
Can anyone please help write a Hamming Distance function that compares two strings, then return the Hamming Distance between them.
Apr 4, 2012 at 2:50pm UTC
just do an AND operator between the two binary numbers and then count the 1's..
shouldn't be too hard
Apr 4, 2012 at 2:59pm UTC
That doesn't work....actually I'm trying to develop a spellchecker application that make use of the Hamming distance.
Apr 4, 2012 at 7:58pm UTC
I do understand the Hamming Distance but I need to create a function using c++
Apr 9, 2012 at 10:40pm UTC
if you are comparing strings with the same length, you can use CompareTexts() - st1.Length, you will get a hamming distance, but i dont know about a proper way or the documented way, i just created that for myself.
Apr 10, 2012 at 12:43am UTC
You'll need to use a loop, for n in [0, length_of_shortest_string - 1], and count the number of times the characters in the strings differ.