Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Homework 2

xainahmed
xainahmed 


Implement a generic class Set that maintains a set of items of generic type T using the List class provided in the src folder1. Your Set class must provide the following functionality: - Membership: that returns true if a given item is in the set and false otherwise. - Union: that returns the union of two given sets. - Intersection: that returns the intersection of two given sets. - Di fference: that returns the difference between two given sets. The above methods should run in linear time in the worst case.  Write a test program that obtains from the user the items to store in two sets A and B, and displays the union A[B, the intersection A\B, and the difference A n B. The data type of the items is your choice. Attachments Tags Clarifications

Answers