Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does my Loop end after 11 Loops?
#69
(02-13-2023, 08:16 PM)Dimster Wrote: Do you feel with todays modern chips and buses there will still be a speed difference between iteration and recursion?

That depends on what you want to do. I have checked again now, and for certain programs, recursion can actually be faster than iteration; apparently when it comes to floating point arithmetic.
The program is written in C, and I have to try it first, then I can try to write it in Basic. If one want, one can try it oneself; see the screenshot*).

The book also reminded me that there are different types of recursion.
A) Direct recursion (faculty program)
B) Indirect recursion (program A calls B, and B calls A again)
C) Tail recursion
D) True recursion (Meant to state that it cannot be replaced by an iterative function)

The German translation of "tail recursion" is a gag:
C) Schwanzrecursion is in English: "cock recursion".  Big Grin

Yes, some things often only look simple at first glance!
The book: Leendert Ammeraal, Program design and algorithms in C, 2nd edition 1998

*)PS: I also made a PDF of it to copy the text, but it doesn't work. I can't copy the text from the file. No idea why not

[Image: Rekursion-Ammeraal.jpg]
Reply


Messages In This Thread
Why does my Loop end after 11 Loops? - by Dimster - 02-06-2023, 07:08 PM
RE: Why does my Loop end after 11 Loops? - by Kernelpanic - 02-13-2023, 10:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Exiting sub while inside a loop PhilOfPerth 5 525 12-05-2025, 09:40 AM
Last Post: PhilOfPerth
  Do Loop, Sleep and Mouse Button Dimster 5 599 09-06-2025, 12:57 PM
Last Post: Dimster
  Using modulo to loop through lists fistfullofnails 3 724 09-03-2025, 11:50 PM
Last Post: fistfullofnails
  What is wrong with this for/next loop Helium5793 6 1,152 04-15-2025, 05:11 PM
Last Post: Kernelpanic
  Question on ln in a for/next loop Dimster 13 2,251 09-13-2024, 11:07 PM
Last Post: Kernelpanic

Forum Jump:


Users browsing this thread: 1 Guest(s)