This factory class defines which data structures to use. The complexity of
the algorithm will depend on the used data structures. Hash based structures
(
DataStructureFactory.MyHashMap,
HashSet) have better average case
complexity and tree based structures (
TreeMap,
TreeSet) have better worst case complexity in Java's standard
implementation. Of course you are free to provide your own data structures
with better computational behavior here ;)
You can simply change the public static instance field which is called
$ to your own implementation of
DataStructureFactory (override some of the methods). The data
structures which are used by default are
ArrayList,
ArrayDeque,
HashSet and
DataStructureFactory.MyHashMap.