Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
EnPy3 /
20130902bHamming distance The Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In another way, it measures the minimum number of substitutions required to change one string into the other, or the minimum number of errors that could have transformed one string into the other. Examples: toned roses The words at the positions in bold are different, thus their Hamming distance is 3. Write a function that calculates the Hamming distance of two strings. Special case The Hamming distance is defined on two strings of equal length. How would you treat that case when the strings' lengths are different? Help: don't modify the strings! If the lengths of the strings differ, then their Hamming distance cannot be calculated. How could you indicate that to the caller of the function? |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |