Object-Oriented Programming · C3.ai · Medium
Write a class that stores a vector in which nearly all of the entries are zero. The class must be able to compute the dot product of its vector with another vector of the same kind, and it should do so efficiently by taking advantage of how few non-zero entries there are. Follow-ups How does the cost of your approach compare with performing the multiplication on the full, dense representation of the vectors? How would you extend this idea to extremely large feature vectors…