The only way to know the size of the product of two polynomials is to perform the operation twice . Wastes running time. For sparse polynomials, it wastes space and run time. Each term in the poly is represented by a node containing data members coefficient and exponent , and a pointer to the next term. Can sort the terms in decreasing order of exponent.
Arithmetic operations reflect only nonzero terms.
For each class, need a list of students in class. For each student, a list of classes taken. Representation of Multilist using Arrays Use a 2-d array, indexed by student and class. As noted, this would be very sparse. Most array entries would be 0.