Implementing Set Abstraction
using Lists
l
A set is not a list,
but
l
A set can be
represented
by a list:
l
simply
ignore
the ordering of the list, and
l
either:
l
ignore
duplicates,
or
l
guarantee no duplicates
l
l
l
Ignoring vs. guaranteeing have advantages and
disadvantages (why?)
called a
representation
invariant