[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Tell me about recursion

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 28
Thread images: 3

File: 1407759609202.jpg (278KB, 1600x1198px) Image search: [Google]
1407759609202.jpg
278KB, 1600x1198px
Tell me about recursion
>>
File: 1500492953509.jpg (284KB, 1600x1198px) Image search: [Google]
1500492953509.jpg
284KB, 1600x1198px
Tell me about recursion
>>
File: ___________.png (76KB, 500x455px) Image search: [Google]
___________.png
76KB, 500x455px
>>
Just look here

>>61460154
>>
Logically elegant but iterative implementations are better (in terms of computation efficiency) in the majority of cases. There are some situations where recursion is the 'only' solution though of course.
>>
>>61460158
REEEEEEEEEEEEEEEEEEE
>>
>>61460145
That's not recursion, that's repetition.

This is recursion:
>>61460115
>>
>>61460166
>situations where recursion is the 'only' solution
Like what? Any recursive algorithm can be made iterative if some stack data structure is used.
>>
>>61460180
>>61460115
>>
I generally prefer iteration over data structures to functional recursion. Recursion is often a poor use of system resources. Why are you slamming your stack like that, anon? What did it ever do to you?
>>
its when a function calls itself during its run, passing a previously-calculated value based on the initial input to each successive recursive call.

they were really popular when programmers had to work under oppressive space limits but not so much anymore now that space isn't much of a problem (for like 99% of problems anyway). unless you are dealing with teeny tiny little firmware programs where it is still an issue.

c++ autists like to wave their dicks around about it because they can't deal with the fact that the performance gains from it are now dwarfed into almost complete marginality because processors just keep getting faster and faster and already obliterate the needs of 99% of user applications even when they are written like garbage
>>
>>61460200
>>61460180
>>
>>61460220
>>61460200
>>
>>61460215
>performance gains
>recursion
What are you smoking man
>>
>>61460193
https://youtu.be/Mv9NEXX1VHc

There's some stuff that's proven that you can't do without recursion. But I've never used that stuff so I usually use recursion for brevity.
>>
>>61460233
>>61460220
>>
>>61460208
CPU cycles are cheap.
Development cycles are expensive.

If it's a time critical part of your program or it's called very often when I agree you should optimize it.
But for the vast majority of code speed doesn't matter and you should go with an implementation that is easy to maintain.
>>
Tail call optimization can solve all Stack depth problems
>>
>>61460239

hnnnng fuck i meant to say "space savings"

it was probably the weed i smoked
>>
>>61460249
You're full of shit.

Never heard of Turing completeness?
It requires either iteration or recursion, but not both.
>>
>>61460249
>computerphile

Do you call yourself a code artisan aswell?
>>
I always use recursion to iterate over trees
is this a bad thing?
>>
>>61460259
Recursion is not the right choice for that, either.
>>
>>61460438
Sometimes it is, sometimes it isn't.

Whichever is the easiest to understand is usually the easiest to maintain.
>>
>>61460288
>>61460288
Fuck wrong video
https://youtu.be/i7sm9dzFtEI

>computerphile
Ad hominem. They do have some interesting videos. But some are clearly made to appeal to inexperienced programmers. Brady is just expanding his audience.
>>
>>61460481 meant to also quote
>>61460295
>>
>>61460336
it uses a lot more overhead than an iterative function that changes a node pointer.
>>
>>61460115
ree
Thread posts: 28
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.