Third Implementation of natMultset
currentSize
maxSize
list
freq
0
. . .
currentSize
maxSize
?
?
?
?
?
?
Representation Invariant: The distinct multiset elements are list[0..currentSize-1], where currentSize <= maxSize, and the multiplicity of element list[i] is freq[i].
public class NatMultiset
{
private int currentSize;
private int maxSize;
private int[] list;
private int[] freq;
. . .
}
. . .
0
?
?
?
?
?
Previous slide
Next slide
Back to first slide
View graphic version