Various Recursive Algorithms(Python)