AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: setSetMode

setSetMode(b) sets the true set mode to b, true or false.

In true set mode, if an element x is added to the set X, it is first checked if x ∈ X. If so, the element is not added. If not in true set mode, x is added without checking the existence of x in X. Thus, X may contain two copies of x afterwards. This will not affect any computations, but two copies of x will be shown when the contents of X is printed out.

When working with small sets, it is recommended to use true sets, but when working with large sets (containing some million elements), the performance penalty for checking (i.e. iteration over a million elements) each time an element is added (perhaps a million times) is not acceptable. Thus, when working with large sets, please do not use true sets.