Hamming distance, KClusters, and Knapsack algorithms