Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
>>>Both points are correct. In some cases, however, it's very hard to write a non-recursive code. However, each recursive problem has non-recursive solution.
>>
>>Are you sure ?
>
>According to the article in Wikipedia: "Any function that can be evaluated by a computer can be expressed in terms of recursive functions, without use of iteration, and conversely."
>
>This seems to be the general belief; I am not sure whether it has actually been proven.
Sure, but exists two class of function:
those that equire for to memorize some intermediary information to every iteration or recursion (on an stack) and those that don't require it.
The first ones are "pure ricorsive function", and even if a loop can be performed,
in reality the iteration it simulates the recursion;
the seconds are "pure iterative function" and it is the recursion that simulates the iteration
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement