handling large data on single computer comparing multiple columns is an expensive operationso you'll need trick to speed this up because the columns contain binary ( or variable to indicate whether customer has bought movie or notyou can concatenate the information so that the same information is contained in new column table shows the "moviesvariable that contains as much information as all the movie columns combined table combining the information from different columns into the movies column this is also how dna worksall information in long string column movie movie movie movie movies customer customer this allows you to calculate the hamming distance much more efficiently by handling this operator as bityou can exploit the xor operator the outcome of the xor operator (^is as follows ^ ^ ^ ^ with this in placethe process to find similar customers becomes very simple let' first look at it in pseudo codepreprocessing define (for instance functions that select (for instance entries from the vector of movies here we take functions (pthat each take (kmovies apply these functions to every point and store them in separate column (in literature each function is called hash function and each column will store bucket querying point apply the same functions to the point (observationq you want to query retrieve for every function the points that correspond to the result in the corresponding bucket stop when you've retrieved all the points in the buckets or reached points (for example if you have functionscalculate the distance for each point and return the points with the minimum distance