M1103 – TD2 – Exercice 4

Faites la trace de l’algorithme suivant en considérant l’appel LS ("","abc");

Algorithm Ls
Input: X and Y two string 
Output:
if (Y.size() == 0) then {
    cout << X; 
    return;
}
char tmp =Y.last ();
Y .pop_back ();
LS(X,Y); 
string Z = X + tmp; 
LS(Z,Y); 

Déduisez la sortie.