hamming-distance

How do I find the k-nearest values in n-dimensional space?

I read about kd-trees but they are inefficient when the dimensionality of the space is high. I have a database of value and I want to find the values that are within a certain hamming distance of the query. For instance, the database is a list of 32-bit numbers and I want to find all numbers that differ from the query value by less tha...

Fast Hamming distance scoring

There is a database with N fixed length strings. There is a query string of the same length. The problem is to fetch first k strings from the database that have the smallest Hamming distance to q. N is small (about 400), strings are long, fixed in length. Database doesn't change, so we can pre-compute indexes. Queries vary strongly, cac...

Take care about precedence of * and ++ in C/C++, (and any keystroke when programming)

Somebody write this function void strToUpper(char *p) { while (*p) { *p = TOUPPER(*p); *p++; //<-- Line to pay attention } } I asked, why do you put the * before p++? answer: because "It's the same", I corrected the code and then stay angry for a while, because both really work the same... void strToUpper...

Algorithm for generating a size k error-correcting code on n bits

I want to generate a code on n bits for k different inputs that I want to classify. The main requirement of this code is the error-correcting criteria: that the minimum pairwise distance between any two encodings of different inputs is maximized. I don't need it to be exact - approximate will do, and ease of use and speed of computationa...

What is the hamming distance, and how do I determine it for a CRC scheme?

While studying for a class in computer networks, the prof talked about the hamming distance between 2 valid code words in a sample code. I have read about hamming distance, and it makes sense from the perspective of telling the difference distance between 2 strings. For example: Code Word 1 = 10110 The sender sends code word 1, and t...