sets and maps in this casethe two students are both taking csci- and econ- thusthe results of executing the previous code segment will be smith and roberts are taking some of the same coursescsci- econ- suppose we want to know which courses smith is taking that roberts is not taking we can determine this using the set difference operationuniquecourses smith differenceroberts for course in samecourses printcourse this example reinforces one of the advantages of working with an abstraction by focusing on what functionality the adt provides instead of how that functionality is implemented by hiding the implementation detailswe can use an adt independent of its implementation in factthe choice of implementation for the set adt will have no effect on the instructions in our example program selecting data structure to implement the set adtwe must select data structure based on the same criteria we used for the bag adt from since we are trying to replicate the functionality of the set structure provided by pythonwe don' want to use that structure that leaves the arraylistand dictionary containers for consideration in implementing the set adt the storage requirements for the bag and set are very similar with the difference being that set cannot contain duplicates the dictionary would seem to be the ideal choice since it can store unique itemsbut it would waste space in this case rememberthe dictionary stores key/value pairswhich requires two data fields per entry we could store the individual items of the set in the key fields and leave the value fields emptybut that would use twice the amount of storage than necessary this waste does not occur with an array or list an array could be used to implement the setbut set can contain any number of elements and by definition an array has fixed size to use the array structurewe would have to manage the expansion of the array when necessary in the same fashion as it' done for the list since the list can grow as neededit seems ideal for storing the elements of set just as it was for the bag and it does provide for the complete functionality of the adt since the list allows for duplicate valueshoweverwe must make sure as part of the implementation that no duplicates are added to our set list-based implementation having selected the list structurewe can now implement the set adt as shown in listing some of the operations of the set are very similar to those of the bag adt and are implemented in similar fashion sample instances for the two sets from figure are illustrated in figure