5. Sets
A set stores a collection of unique elements with no particular order.
Abstract Data Type: Set
Data:
- A collection of unique elements with no particular order.
- Size of set.
Pseudocode | UML | Description |
---|---|---|
contains(key) |
+contains(key: K): boolean |
Checks if the key k is in the set. |
add(key) |
+add(key: K): void |
Adds the key k to the set. |
remove(key) |
+remove(key: K): V |
Removes the key k from the set. |