Written with C++ and Pseudo Code