Homework 4 Multiset

Homework 4 Multiset - Multiset.h#ifndef...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#ifndef MULTISET_INCLUDED #define MULTISET_INCLUDED typedef unsigned long ItemType; class Multiset { public: Multiset(); // Create an empty multiset. bool empty() const; // Return true if the multiset is empty, otherwise false. int size() const; // Return the number of items in the multiset. For example, the size of // a multiset containing "cumin", "cumin", "cumin", "turmeric" is 4. int uniqueSize() const; // Return the number of distinct items in the multiset. For example, // the uniqueSize of a multiset containing "cumin", "cumin", "cumin", // "turmeric" is 2. bool insert(const ItemType& value); // Insert value into the multiset. Return true iff the value could be // inserted. (For a linked list representation, insert always returns // true.) int erase(const ItemType& value); // Remove one instance of value from the multiset if present. // Return the number of instances removed, which will be 1 or 0. int eraseAll(const ItemType& value);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/07/2009 for the course CS 32 taught by Professor Davidsmallberg during the Spring '08 term at UCLA.

Page1 / 4

Homework 4 Multiset - Multiset.h#ifndef...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online