Next: Appendix: The Int class
Up: Programming with Lists
Previous: List programming in Java
  Contents
Implement the following in both ML and Java .
- Develop an abstract data-type called
. Represent a set of integers
as a list (there should be no duplications) and develop functions
for
- Adding a new element to a set.
- Checking whether an element belongs to a set.
- Finding the intersection of two sets.
- Finding the union of two sets.
Estimate the time complexity of each operation.
- Represent a set as an ordered list of integers and develop
functions for each of the above operations. The time complexity
of each of the above functions should be linear.
- Consider a representation of univariate polynomials as lists
of pairs of the type (coefficient, exponent). For example, the polynomial
may be represented as the list
.
Assume that the polynomials are in their canonical form, i.e,
the exponents are in the decreasing order.
- Develop algorithms/functions for adding and multiplying two polynomials.
Estimate the time complexities of your algorithms.
- Develop Java function/procedure for reading and printing
a polynomial.
Next: Appendix: The Int class
Up: Programming with Lists
Previous: List programming in Java
  Contents
Subhashis Banerjee
2003-08-02