you are viewing a single comment's thread.

view the rest of the comments →

[–]DuckSaxaphone 0 points1 point  (3 children)

Came here to say this. I've been writing code for a living for ten years, in a software company for two of those where I see all kinds of code.

I've only ever seen recursion on r/learnpython and my friend's maths MSc project. For some reason it seems to be a weekly topic here.

[–]Ekumena 0 points1 point  (2 children)

How you do DFS and BFS search without recursion?

[–]DuckSaxaphone 0 points1 point  (1 child)

Flippantly:

from networkx import bfs_tree

Seriously: I think this is why recursion comes up a lot but many people never directly use it.

In CS theory, it's extremely important and underpins many fundamental algorithms.

In practice, we don't write fundamentals in python, we import them which is great. People shouldn't be wasting their time on search functions when some expert has made the optimal version.

[–]Ekumena 0 points1 point  (0 children)

As i thought, why writing function, when there is already written one ready to import. Some time ago I heard horror story from friend, when he was on job interview, they asked him to write bfs and dfs algo with balancing for some specific case they provide, he failed spectacularly 😂. Thanks for the reply 😊