Method insert
/* Insert item into the multiset; throw RuntimeException if out of space. */
public void insert(int item)
{
if ( currentSize==maxSize )
throw new RuntimeException(
"NatMultiset too large for bounds”
);
else {
list[currentSize] = item;
currentSize++;
}
}
Previous slide
Next slide
Back to first slide
View graphic version