Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recursivity
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Titre:
Divers
Thread ID:
00048680
Message ID:
00048821
Vues:
51
>Sure, in theory each recursive level can make calls to the next level multiple times sequentially without eating calling levels because the previous down level call returns before the next down level call is issued. This renders 2 levels to the caller - callee relationship. Now we have 32 levels of caller to calle possibilities, therefore 2 (the caller-callee relation) ^ 32(the number of caller-callee relations allowed) possible levels of recursion.

I believe that this concept applies best to situations where one is predicting computational effort when dividing (splitting) a list into 2 parts. For example, the QuickSort algorithm and binary tree search algorithm are two cases where the # of required comparisons is proportional to LOG2(N). But there are other uses of recursion where this model doesn't hold as neatly. For example, the algorithm for converting infix to postfix: The parser will fail using recursion in VFP if the expression happens to have 32 nested levels of parenthesized expressions (OK, not likely, but has nothing to do with 2^32). Likewise for any tree-type of data structure that might have 32 or more levels: in a worst-case situation (i.e., very unbalanced tree) you can/will recurse beyond VFP's recursion limit.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform