Implement Similarity Algorithm