searching and sorting listing the binaryset py module implementation of the set adt using sorted list class set creates an empty set instance def __init__self )self _theelements list(returns the number of items in the set def __len__self )return lenself _theelements determines if an element is in the set def __contains__selfelement )ndx self _findpositionelement return ndx lenself and self _theelements[ndx=element adds new unique element to the set def addselfelement )if element not in self ndx self _findpositionelement self _theelements insertndxelement removes an element from the set def removeselfelement )assert element in self"the element must be in the set ndx self _findpositionelement self _theelements popndx determines if this set is subset of setb def issubsetofselfsetb )for element in self if element not in setb return false return true the remaining methods go here returns an iterator for traversing the list of items def __iter__self )return _setiteratorself _theelements finds the position of the element within the ordered list def _findpositionselfelement )low high lenthelist while low <high mid (high low if thelistmid =target return mid elif target thelistmid high mid else low mid return low