Swift implementation of various C++ algorithms.