Department of Computer Science | Institute of Theoretical Computer Science | CADMO

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// IFMP Serie 9, Aufgabe Challenge // Programme: mytree2 // Recommended number of iterations: 5 // Author: Nicola Nesa, Gruppe I #include #include void f (const int n) { if (n==0) ifm::forward(); else { f(n-1); f(n-1); ifm::save(); ifm::left(20); f(n-1); ifm::left(30); f(n-1); ifm::right(30); f(n-1); ifm::right(150); f(n-1); ifm::right(30); f(n-1); ifm::restore(); ifm::save(); ifm::right(25); f(n-1); f(n-1); ifm::restore(); ifm::forward(3); } } int main () { std::cout << "Number of iterations? "; unsigned int n; std::cin >> n; ifm::left(90); f(n); return 0; }