Efficient algorithms for collaborative filtering