Question: In Python please!!!! Create class IntegerSet. Each IntegerSet object can hold integers in the range 0100. The set is represented by a list of booleans.

In Python please!!!!

Create class IntegerSet. Each IntegerSet object can hold integers in the range 0100. The set is represented by a list of booleans. List element a[i] is true if integer I is in the set. List element a[j] is false if integer j is not in the set. The no-argument constructor initializes the list to the empty set (i.e., all false values). Provide the following methods: Method union creates a set thats the union of two existing sets (i.e., an element of the new sets list is set to true if that element is true in either or both of the existing setsotherwise, the new sets element is set to false). Method intersection creates a set which is the set-theoretic intersection of two existing sets (i.e., an element of the new sets list is set to false if that element is false in either or both of the existing setsotherwise, the new sets element is set to true). Method insertElement inserts a new integer k into a set (by setting a[k] to true). Method deleteElement deletes integer m (by setting a[m] to false). Method toString returns a string containing a set as a list of numbers separated by spaces. Include only those elements that are present in the set. Use --- to represent an empty set. Method isEqualTo determines whether two sets are equal. Write a program to test class IntegerSet. Instantiate several IntegerSet objects. Test that all your methods work properly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!