5 ms·
Recursion is a fundemntal part of programming, beyond the self-taught junior yes I would absolutely expect every programmer to be able to do it. You learn it i
by ido 6y ago
Recursion is a fundemntal part of programming, beyond the self-taught junior yes I would absolutely expect every programmer to be able to do it.
You learn it in highschool level programming classes & first semester intro to CS college courses.
Even if they won't specifically need to use recursion in their next job it marks them as someone not serious or about programming.
- charlesu 6y agoI'd argue that not being able to program in C marks someone as not serious about programming, but that's mostly because I know and like C.
- ido 6y agoI didn't say it was the only criteria, just that it is one.
- charlesu 6y agoMy point is that these criteria are largely meaningless. It all depends on what you're working on. In some jobs, you'll occasionally need to write a recursive function. In others, it's probably a benefit if you can't.
- ido 6y agoI never personally used it in an interview (that's generally not how I do interviewing) but for someone experienced having not heard of recursion (and it's not such a complicated subject, you wouldn't need much "experience using recursion" to be able to understand it) would mean they haven't really dug into the art & craft of programming. Just like I'd expect a moderately senior developer to be able to program in procedural, object oriented & functional styles even if they strongly prefer one to the others (and how would they know if they haven't tried all of them?).
- andi999 6y agoHonestly I think recursion is overrated. Does anyone here really write recursive functions in production? I mean it takes up stack space (which on some systems is a systemparameter), creates functioncall overhead and has rarely advantages. Trees have more natural recursive structures, but then you basically always have cache misses making your program orders of magnitude slower than if you can fit the data in a linear structure. I mean, I would be worried if a candidate is not shy to use recursion that this will blow up software perfomance. (But then probably after hire the senior will tell: dont use recursion here)
- jimbokun 6y agoIf you can take a problem where I'm thinking of a recursive solution as the interviewer, but you can come up with an iterative solution and explain why you think it's better, I would give you full marks.
- andi999 6y agoThats not the point. I think it is possibly harmful to focus on recursion in teaching and interviews. (Of course if the understanding is, that you do not use it in real life, then its ok, but still why not test people on skills they need for the job; its like making people jump through hoops for a swimmers position). Of course I will be embarressed soon, when it is only me who doesnt use recursion in production. :-)
- creata 6y agoI don't know what goes on in the minds of interviewers, but if I had to guess, they use recursion to test the interviewee's ability to reason inductively --- which, of course, is necessary for writing even simple loops. Maybe a question about loop invariants might be a good replacement. Regardless, yes, I doubt many people write a lot of recursive functions, since the data structures people use tend to either be flat, based on arrays, or neatly hidden away in libraries.
- 6y ago