code the lsh algorithm with cosine distance