Method insert
/* Insert item into the multiset; throw RuntimeException if item out of range. */
public void insert(int item)
{
if ( item < 0 || item > maxValue )
throw new RuntimeException(
”item out of range for NatMultiset”
);
else freq[item]++;
}
Previous slide
Next slide
Back to first slide
View graphic version