Implementing Various Algorithms in Python