The MexSet data structure is an implementation of a set that can quickly find MEX.
The MEX (Minimum EXcluded) of a subset of the set of natural numbers is the minimum natural number missing from this subset. That is, it is the minimum value of the complement set.
As a library
```rust use mexset::MexSet;
let mut set: MexSet
set.insert(2); set.insert(1); asserteq!(set.minimumexcluded(), 0); // 0 is the smallest missing number
set.insert(0); asserteq!(set.minimumexcluded(), 3); // mex({0, 1, 2}) = 3
set.insert(4); asserteq!(set.minimumexcluded(), 3); // mex({0, 1, 2, 4}) = 3
set.insert(3); asserteq!(set.minimumexcluded(), 5); // mex({0, 1, 2, 3, 4}) = 5
set.remove(&1); asserteq!(set.minimumexcluded(), 1); // mex({0, 2, 3, 4}) = 1 ```
If you have any comments or suggestions, or you suddenly found an error, please start a new issue or pool request.