question archive Q3) Cosine similarity between 2 vectors
Subject:Computer SciencePrice:4.86 Bought11
Q3) Cosine similarity between 2 vectors. You are given two vectors. You have to print the cosine of the angle between the two vectors. Input format : First line contains n which is the dimension of the 2 vectors. The second line contains 2n numbers in the following format : a_1, b_1, a_2, b_2, a_3, b_3, .. a_n, b_n where a_i is the i" component of the first vector and b_i is the " component of the second vectors. You are guaranteed that none of the vectors are 0. Output format : Print cosine of the angle between the 2 vectors on a single line upto 2 decimal places.(search the command for this )
Purchased 11 times