| |
- builtins.object
-
- Set
class Set(builtins.object) |
|
Using internal python set() was forbidden. Many optimization would be possible otherwise (especially in &, |, -
and get_list methods) |
|
Methods defined here:
- __and__(self, other)
- Performs cross-section of two Sets in O(n).
:param other: second Set
:return: resulting Set (cross-section)
- __contains__(self, e)
- Method returns boolean type indicating if a specific object is present in Set, in O(1), abs worst case is O(n).
:param e: tested element
:return: True/False
- __init__(self)
- Initialize self. See help(type(self)) for accurate signature.
- __iter__(self)
- __len__(self)
- "
Length O(1)
- __or__(self, other)
- Performs union of two sets in O(n) where n is the sum of number of elements of both sets.
:param other: second set
:return: resulting Set (union)
- __str__(self)
- Return str(self).
- __sub__(self, other)
- Performs difference (complement) of two Sets in O(n).
:param other: second Set
:return: resulting Set (complement)
- add(self, e)
- Method adds element to SET in O(1)
:param e: element to be added to set
:return: None
- clear(self)
- discard(self, e)
- get_list(self)
- O(n)
:return: List of Set elements.
- pop(self)
- remove(self, e)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |