Topics:
- abstract data types: set, multiset (bag)
- concrete data structures: hash table, circular buffer
- set operations
Challenges:
- implement
HashSetclass (set with hash table) with the following set operations as instance methods and properties:__init__(elements=None)- initialize a new empty set structure, and add each element if a sequence is givensize- property that tracks the number of elements in constant timecontains(element)- check whetherelementis in this setadd(element)- addelementto this set, if not present alreadyremove(element)- removeelementfrom this set, if presentunion(other_set)- return the union of this set andother_setintersection(other_set)- return the intersection of this set andother_setdifference(other_set)- return the difference of this set andother_setis_subset(other_set)- check whetherother_setis a subset of this set
- write your own unit tests for your
HashSetclass- include test cases for each class instance method
- annotate all class instance methods with running time complexity analysis
Stretch Challenges:
- implement
CircularBufferclass with dynamic array - write your own unit tests for your
CircularBufferclass- include test cases for each class instance method
- annotate all class instance methods with running time complexity analysis