Java Reference
In-Depth Information
Figure 1
A Set of Printers
700
701
In mathematics, such an unordered collection is called a set. You have probably
learned some set theory in a course in mathematics, and you may know that sets are a
fundamental mathematical notion.
A set is an unordered collection of distinct elements. Elements can be added,
located, and removed.
But what does that mean for data structures? If the data structure is no longer
responsible for remembering the order of element insertion, can it give us better
performance for some of its operations? It turns out that it can indeed, as you will see
later in this chapter.
Let's list the fundamental operations on a set:
ȗ Adding an element
ȗ Removing an element
ȗ Containment testing (does the set contain a given object?)
ȗ Listing all elements (in arbitrary order)
Search WWH ::




Custom Search