4 ms·
C and C++ seem to be the languages of choice lately for the interview complaints. I wonder if that's indicative of the language itself or of the number of peopl
by ydant 16y ago
C and C++ seem to be the languages of choice lately for the interview complaints. I wonder if that's indicative of the language itself or of the number of people who actually program in those languages.
Of the questions / problems expressed in the article, I think I have a decent grasp of most of them, and I don't program in C or language with similar ideas. I did learn with C (and then expand that knowledge to C++), but that's been a long time ago. To not be able to traverse a linked-list, though, that baffles me. Simply shouldn't be appling for a job programming in C or C++ and not understand linked lists.
- habitue 16y agoIf you have to traverse a linked list at any time to reverse it, you're doing it wrong.
- roel_v 16y agoHow would you reverse a singly linked list without traversing it? (and without knowing implementation details too I guess - doing pointer arithmetic and storing the size somewhere else doesn't count).
- mjw 16y agoI think he means: if you have to traverse it without building up a result (or doing some in-place modification) as you go - then you're doing it wrong. Obviously you gotta traverse the thing at least once.
- ydant 16y agoIf that's what he meant, his comment was pretty much useless. Anyway, I misread "traverse" for "reverse", hence my incredulous comment. Perhaps traverse means different things to the two of us.
- jallmann 16y agoIt's not about the language, it's about how you approach the problem. Maybe their rationale is that using C discourages the use of built-in constructs or libs that circumvent doing the real work. For this type of problem, it also hints at your understanding of indirection and pointers as opposed to stack allocated values, etc. Pretty much a pre-requisite if you're doing anything remotely performance-critical, like rethinkdb is. When you're dealing with a higher level language, that's all abstracted away by references.
- spatulon 16y agoIt's been long enough since I regularly wrote C that I spent more time figuring out the old "struct vs typedef struct" issue than I did writing the reversing algorithm.