Below are sample problems used in the IEEEXtreme 2006 challenge.
Value rank: 40 Simple matching, Jaccard, Tanimoto and cosine
similarities are statistics used for comparing the similarity
and diversity of sample sets. They are used in data mining for
tasks ranging from classifying diverse chemical compounds to
text processing and searching in large databases. The sample
sets for comparison are represented with vectors of the
attributes we want to compare. Given 2 vectors of attributes, A
and B, the cosine similarity, θ, can be calculated using the dot
product and the magnitudes as: Since the angle, θ, is in the
range of [0,π], the resulting similarity will yield the value of
π as meaning exactly opposite, π / 2 meaning independent, 0
meaning exactly the same, with in between values indicating
intermediate similarities or dissimilarities. Your task is to
write a program that receives A and B, attribute vectors, and
outputs the cosine similarity of those vectors A and B will be
entered as parameters in the comm