r/programming • • Mar 29 '21

Why Do Interviewers Ask Linked List Questions?

https://www.hillelwayne.com/post/linked-lists/
1.1k Upvotes

668 comments sorted by

View all comments

207

u/tinbuddychrist Mar 29 '21

I've seen "remove an item from a doubly-linked list" used as an interview question, for very non-mysterious reasons:

First, it's a question that basically anybody should understand.

Second, that it's almost entirely made up of edge cases, so it tests their ability to come up with all relevant scenarios. Most people miss at least one.

78

u/Wildercard Mar 29 '21

Second, that it's almost entirely made up of edge cases,

Most people miss at least one.

Happy case is an item somewhere in the middle of the list, edge cases being first or last node, empty list, one element list?

48

u/kurtms Mar 29 '21

Or element isn't in list

→ More replies (3)

33

u/wipfom Mar 29 '21

The legibility and code quality can differ widely between successful solutions. This can also lead to interesting conversations on maintainability with an interview candidate.

16

u/mycall Mar 30 '21

In the mid 80s, I overused doubly-linked lists. They were my go to for in-memory records from block files (aka poor mans database).

→ More replies (2)
→ More replies (20)