Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recursion: 4 ways to get it working
#5
(02-14-2023, 09:13 PM)Dimster Wrote: My apologies Tempodi - it's not DEPTH I meant but STACKed. Iteration is depth to me as to how many wooden dolls can be fit into one another. That's what depth is to me. But recursion can't do that, recursion can be stacked on recursion call on top of another. My question is, is there one Recursion type you have demonstrated better than another for Stacking?

Hi Dimster
as already SMcNeill said :" It is the amount of available RAM to define how many recursion is possible to do until we get Overflow.
Going to analyze the different methods of recursion...

1. recursive calling a SUB with parameter as flag  

2. recursive calling a SUB with Global Shared variable as flag or a Shared variable between main and SUB recursive

3. recursive calling a SUB with STATIC option to preserve local variable as flag or a STATIC group of variables

we must answer to these questions to be able to answer to your is there one Recursion type you have demonstrated better than another for Stacking?

Is there a difference in speed of access to the variable if it is a parameter of SUB or a Global Shared variable or a SHARED variable or  a STATIC variable?
Is there a difference in amount of RAM used using these different methods? Otherwise a parameter vs global shared vs shared vs STATIC local variable does use different quantity of RAM?
Well, I think that these features depend on the architecture of compiler/interpreter and how it works with stack. 
In this point of view , for QB64pe the answer can arrive from developers of QB64pe.
Reply


Messages In This Thread
RE: Recursion: 4 ways to get it working - by TempodiBasic - 02-14-2023, 10:52 PM



Users browsing this thread: 5 Guest(s)