Basic implementations of algorithms in Python