In mathematics, a set is a group of distinct items. Design and implement (using an array) an ADT Set that supports the following operations:
+createSet()
// creates an empty set
tisEmpty()iboolean {query}
// Determines whether a set is empty
+size():integer {query}
// Returns the number of elements in this set (its // cardinality)
+add(in item:integer)
// Adds the specified element to this set if it is not already // present *
+contains(in item:integer):boolean {query}
// Determines if this set contains the specified item tunion(in other:Set):Set
// Creates a new set containing all of the elements of this // set and the other set (no duplicates) and returns the // resulting set
+intersection(in other:Set):Set
// Creates a new set of elements that appear in both this set // and the other set and returns the resulting set
+removeAll()
// Removes all of the items in the set
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.