Nearest neighbor algorithm to find the most similar object within an array of objects.