5 ms·
I don't agree with the author that iterative code is bad (within a certain context). In fact, I tend to write iterative solutions first when I am just testing s
by dreaminvm 12y ago
I don't agree with the author that iterative code is bad (within a certain context). In fact, I tend to write iterative solutions first when I am just testing something out and develop more elegant, recursive solutions when I have a better understanding of the problem (which might not be possible when you are dealing with interview anxiety and an interviewer breathing down your neck).
- ojbyrne 12y agoI didn't get the impression he was saying that. Quote: "The truth is that in most embedded/real-time/kernel work, we almost never see actual recursion. When there are strict bounds on stack sizes, recursive algorithms can be downright dangerous, especially when operating on user-supplied data."
- dreaminvm 12y agoHe set the tone at the beginning of the article with the following: "There’s a particular sinking feeling that comes when the candidate starts on one of these problems and immediately writes a for loop"