>i use iteration over recursion for "performance" and not because i'm a retard
I use iteration over recursion for "performance" and not because i'm a retard
Nice self portrait, retard
please kindly write the foor loop sir
Totally depends on the language and compiler, dumbass.
If you don't have tail call optimization its very possible recursion will be worse. Give me a momment, I'll get you an example of the assembly so you can see why you're retarded.
You seem like an assblasted pajeet.
Kindly write the for loop.
These posts are extremely poor quality. Can we get some mods in here?
>pajeet begging for mods because all he can do is kindly write the for loop
You do know recursion is for brainlets who can't write their own stack, right?
you still have to write tco functions for that to even work, and even then, iteration is still faster 99.999% of the time
>I use iteration because I know most people find it hard to read, so it makes me feel smart. I also using C++ member function pointers without typedefs and invoke them with the native. I have never worked on any serious project and thus can't imagine the advantage of readability, extensibility and self-documentation.
you do realize that processors have their own stack?
>doing anything for "performance" without measuring first
>writing code for anyone but yourself
it's like you want problems
>t.
It's context dependent. Using recursion for everything is asking for an overflow in a lot of occasions.
Recursion or else mapping if you really can't use recursion.
For loops are Pajeet tier
Do pajeets even know for syntax? Recursion is the simpler concept.
It's been 20 minutes, Pajeet. Where's the assembly?
This user is right you know
Sad bad code
for (const i in array)
console.log(array[i])
MMmMm ReeCorsOn
function recursion (i) {
console.log(array[i])
if ((parseInt(i)+1) !== array.length)
return recursion (i+1)
}
recursion('0')
>using a for loop when you could use recursion
>not using goto
God I cant imagine being that bad that I have to use goto
Your lack of comprehension and experience is showing. lmao
Recursion creates stackoverflows
I love recursion just as much as the next guy but I avoid it when possible. The compiler might optimize. Or it might not. With a for loop you won't run into trouble with recursion if shit goes south you will get fucked.
i dont know of any compiler that can optimize naive recursion
>Recursion creates stackoverflows
>stack based "languages"
>he doesn't use folds instead of explicit recursion
I recall that cache-oblivious algorithms need to be recursive right?
But it all depends, also sadly recursion interacts badly with the JVM.
Use a better language brainlet.