(it is no excuse that he couldn't implement them, especially given you can google tens of thousands of implementations of each in every language imaginable, but I can't for the life of me come up with a reason to create yet-another-implementation in this day and age)
struct foo { int x; struct foo *next; };
(a simple struct for your linked list isn't really the implementation for the linked list operations. obviously in C you would define your own next pointer. i seriously doubt this guy had trouble with that part of it.)
void delete_nodes(struct node n) {
if (n.next)
delete_nodes(n->next);
free(n.next);
}
like that?Heck, I'm pretty sure I could teach pointers to someone who has only worked in matlab occasionally by cut-and-pasting others code in less than 30.
And teaching someone something new during an interview and seeing if they can understand it and then turn around and use it is far more valuable for interviewing the types of people I want to hire than asking them random questions they could find the answer to on google in less than a minute.
Linked lists are ubiquitous in programming, hooking up a library every time you need a linked list is as same as using some library for loops. Sure, you can get some fancy loops with guards and Duff's device built-in, but in some fields of programming you will be laughed out of the job if you ever try to do this.
You seem to suggest that there's a wide variety of linked list implementations whose existence you agree with, so at least you agree that some programmers should be making linked list implementations.
/rolleyes
Clearly, this is not conducive to creating a repeatable test. Therefore any test must involve reproducing code that already exists.
If you are going to ask a candidate to reproduce code that already exists, it stands to reason that you would ask them to create something for which the definition is well understood in order to make the question fast to ask and require little explanation.
Therefore a linked list or hash table is a good example of a practical coding question. It's a good test to give you a negative result even if it's not a good test to get a positive result.
In other words, unless the job is literally about finding creative ways to implement linked lists, then it is near worthless as an interview question. (I say "near worthless" because there is some value in seeing how candidates respond when given questions that are obviously nonsensical or just outright dumb.)
I wouldn't expect someone who's taking one computer science class to be able to implement a hash table.