Implementation of Non-Deterministic Finite Automata and Deterministic Finite Automata, and the conversion from the former to the latter