Implement a k-nearest neighbor recommendation algorithm