
Why Linked Lists Are an Interview Staple - thrower123
https://mobile.twitter.com/hillelogram/status/962424365819277312
======
umanwizard
Very interesting thread -- if you're the type of person who comes to the
comments before deciding whether to read, I recommend it.

I'd also like to point out that today in 2019, linked lists perform like
absolute dog shit in many real-world contexts even where they have the best
big-O notation.

Somebody jumping straight to a solution based on linked lists without at least
mentioning memory latency is a sure-fire sign that they have never done
detailed CPU performance work. (Which is not necessarily a requirement for
most programmers, but it's one piece of signal among others).

~~~
cortesoft
I can't read the link, because twitter links never work on my phone... always
'something went wrong' and saying I am rate limited.

~~~
saagarjha
As far as I can tell, this is some sort of thing that Twitter does to Safari
users because it can't fingerprint them well and thinks it might be abuse.

~~~
sgift
Thanks for the hint. That could be the reason I get this on nightly since ..
about four weeks (or six weeks? something like that). Seems to concede with
the time the new privacy protections went on by default.

~~~
IshKebab
It's not recent - I've had this for years.

~~~
WorldMaker
I've only just noticed it, but mostly because I've forced myself not to
install the Twitter app nor login to my account on the particular device I've
been experiencing all these "Something Went Wrong" errors. I assumed it was a
"feature" to encourage people to login to the app caused from a bug somewhere
in the ad stack, and this seems to corroborate that hunch.

------
hwayne
Yo, author here. One thing I should really clarify is that while it's a nice
sounding argument, my research was pretty haphazard- looking at TIOBE and C
programming and extrapolating from there. I recently started doing more
thorough research- interviewing people, reading way too many Usenet archives,
stuff like that. Based on that I'm _pretty sure_ the main argument still
holds, but the story is a bit more complex than the tweetstorm makes it seem.
And there's a few sources I haven't dug into yet. Who knows, maybe one of them
will completely refute me!

I plan on doing a full writeup, but I gotta finish the research first! And if
it turns out that I was completely wrong, then I'll write a postmortem instead
:)

~~~
wayoutthere
I suspect it was also a way to make sure people had and remembered a formal CS
education. Data structures classes were standard in CS curriculum until at
least the late-2000s, and linked lists were definitely one of the topics. To
that end, I’ve been asked other data structure questions around trees and
stacks as well — I view all those as a proxy for “so prove to me you remember
your second year CS classes.”

~~~
cylentwolf
What does that help prove though? That I have a good memory? There are better
data structures in pretty much all standard libraries out there for your
flavor of language. I am sure that my 2nd year CS class didn't go into the
nuances of the coding of the linked list. If I remember correctly it was just
make sure you can write one by the end of the week and turn it in.

~~~
dragonwriter
> What does that help prove though?

It's a weak filter for “recent grad”, and along with other individually weak
filters a tool for under-the-radar age discrimination.

~~~
umanwizard
Well it is correlated with being a recent CS grad, just like, for example,
knowing that d(sin(x))/dx = cos(x) is correlated with being a recent math or
engineering grad.

But that's certainly not what it actually measures, which is basic knowledge
about data structures. It just so happens that being a recent CS grad _is_
statistically correlated with knowledge about data structures.

But it's certainly not a necessary condition. I am not any sort of CS grad,
recent or otherwise, and I still know how to implement a linked list, because
I learn things on my own, and refresh my memory about things I forget over
time.

------
xondono
I’ve always thought that in that aspect hardware interviews are much better.
The typical approach I’ve seen is to give someone a PCB and just ask them
“tell me everything you can figure out from this device”.

I’ve always wanted to test how well that would work for software interviews:

\- print some pages with the source file of a toy project

\- give the interviewee a pen and just ask “tell me all you can about this
code”

~~~
cableshaft
One of my best interview experiences was exactly that. The interviewer handed
me a printed out class and said "tell me what this does, any mistakes you see,
and any little improvements that you think could be made."

I got the job and later confirmed it was a class that was actually in the
software I would be working on, not some toy class he came up with.

He also asked me a handful of technical questions and had me go over some
source code I brought in, but that was about it. At one point he even said, "I
know enough to know you can do the job, but now I'm curious what you really
know." And asked me some no pressure really low level questions. When I said I
didn't know the answer to something he'd spend a couple of minutes explaining
the concept to me.

I walked out of that interview having learned a few new things about my field.
A couple of them have stuck with me over a decade later.

And the guy was a grizzled veteran who was the lead on some massive mainstream
projects I pretty much guarantee you've heard of. He's probably the most
knowledgeable programmer I've ever met.

I've never had anyone try going over actual with me since, in probably a
couple dozen interviews, and I don't understand why. It seemed very effective.

------
alaaibrahim
I've interviewed a lot of people, and I've asked LL questions, besides other
algorithmic questions, and mostly I ask these questions to new grads with no
much experience. The reason is, if you don't have much work experience, what
else would I ask you, it's something that you've been learning about recently
in your CS degree, and I want to see if you can apply what you learned.

If you have work experience that is relevant, or don't have a CS degree, I'll
ask something else.

For me I feel that a lot of people don't understand that an interview is a
conversation, feel free to think out loud, ask questions, and ask for help. I
want to see your thinking process, I don't really care about the actual
solution.

~~~
ramraj07
Thanks. Unfortunately this is not the case always. I explicitly start
interviews telling I'm not academically trained in CS even though I've been
practically coding for decades, and I tell them if they ask some "in paper" CS
question, I might not answer well. People still ask me to do merge sort -
which frankly isn't even in theory that hard - but I think I've subconsciously
refused to learn a sorting algorithm just so I can answer a stupid interview
question (the day I need to optimize a sorting problem myself I'll learn it
hopefully). Whenever the person still insists on asking this without any help,
he also comes off as a douche who can only see in black and white.

Should I suck it up and learn these things to do better in interviews? Maybe.
But thankfully this handicap became a nice filter and I'm in a nice job where
people value real experience and "getting things done" more than linked lists
and merge sort, so won't need to worry about dealing with these folk for a
long time hopefully.

~~~
valtism
This is why I'm not going to apply for Google any time soon. Their entire
hiring process seems to revolve around how much CS trivia you memorised at
school.

------
thethirdone
Every time the topic of algorithmic questions in interviews come up I am left
wondering if these questions are really as hard as they are made out to be.

I would expect most programmers who are not just plumbing together existing
technology to be able to implement push,pop,... for linked lists without
having to study. You have to do harder things as part of regular programming.

> take "determine if a linked list has a cycle in it."

I do think that this question if asked without any support if they get stuck
is a bad question. You would be relying on the interviewee to either be aware
of that research, require that they have the spark of insight, or allow a very
suboptimal program.

That said, just being aware of the general solution (two pointers moving at
different speeds) is enough for me to be confident I could make a solution.

~~~
shados
> I am left wondering if these questions are really as hard as they are made
> out to be

It's not really about how hard they are, and more about:

"Ive never once in my career had to use this on the job, why is it asked in an
interview, thats stupid!".

That's usually the answer you'll get. But I think that answer contains a lot
more info than what we can gather from it at first glance.

First, good places will give you hints about what the interview might contain
long before you show up. If it's for one of the well known big techs, the
questions are all over the internet. They know this. The question essentially
amounts to: "Can you make sure you know something about computer science if we
ask you to know it". If your answer is "No, that's not worth my time, I'm
better than this!", well, I can see why someone wouldn't hire you.

The second part, is that it is a self fulfilling prophecy. 20 years ago, a
typical team was mostly CS majors, with the occasional odd one out who didn't
(I was one of those odd ones out). That means if you didn't know it, it didn't
really matter. You could just turn around and bounce it off one of your
colleagues. If you made a mistake, they'd catch it. Today however, especially
in fields like frontend development, its extremely likely ZERO person in the
team has a CS background, or the 1-2 people who did don't remember anything
from their college years. That means some problems quickly fall in the
category of "This isn't worth trying, let's use a 3rd party solution or wait
until the one expert in the company does it for us".

Thus, self fulfilling prophecy: you don't need to know these things because
the industry punted on the problems you'd need these things to solve, or
deferred them to other departments. Web apps, for example, are often very
animation light, or low on more advanced graphics, because no one knows the
math to make these things happen anymore aside from using a library to make a
pretty chart. Since your competitors are in the same boat, there's no pressure
to change that. And then those folks feel its dumb to ask these questions in
interviews (They don't need it!), and the cycle keeps going.

"Why would I need these if Im building forms in javascript all day!". Well,
maybe if more people in the team knew how to do more than build forms, we
could try and build something fancier than forms.

~~~
scarface74
_This isn 't worth trying, let's use a 3rd party solution_

You act as if this is bad thing. The last thing I want is another bespoke
logging solution or ORM.

You can’t imagine the times I gladly ripped out my own bespoke solution for a
third party one after finding one was available.

No sane company hires experienced developers to “develop”. They hire
developers to have a breadth of industry knowledge to know when to build and
when to outsource the “undifferentiated heavy lifting”. During the last few
years, both companies I’ve worked for both in an architect level positions
have never blinked at solutions that cost money over costing developer time in
both development and maintenance.

 _Web apps, for example, are often very animation light, or low on more
advanced graphics.... Well, maybe if more people in the team knew how to do
more than build forms, we could try and build something fancier than forms._

Again you act like this is a bad thing. I came into a company where the dev
leads were younger and relatively fresh CS grads and even the manager of the
department was relatively young. He was the founder of the company before it
got acquired.

They had so many ideas about the “right” way to do things and spent so much
time arguing about how many angels can dance on the head of a pin they
couldn’t ship software for crap.

You see the same thing at Google. After two decades, billions of dollars,
untold cancelled projects and with all the smart people they have, almost all
of their revenue still comes from advertising.

I saw so many head scratching overengineered custom developed systems that
could have been done a lot simpler if they had had any real world experience.

On the opposite end, I was hired two years ago with a mandate partially to
migrate all of the bespoke, complicated systems and use managed services/use
third party packages where ever possible.

~~~
shados
> act as if this is bad thing. The last thing I want is another bespoke
> logging solution or ORM.

I didn't quite capture the nuance of what I meant. Sorry about that. Of course
if a third party does what you want go for it. But in the situations I'm
thinking of, sometimes it's not and people just force their requirements into
a suboptimal model. Form validation libs are an obvious example. High level
chart libs are another think highchart vs D3)

~~~
scarface74
Business decisions are often made based on forcing requirements onto a
commercial third party solution that gets you 90% there instead of spending
money up front and in ongoing maintenance to get 100% there. If your company
isn’t going to have a competitive advantage, make enough money or save enough
money to make that 10% difference worth it, the sacrifice is often worth it.

How many companies adjust their entire process around Salesforce, some Oracle
enterprise solution, or project management software?

------
RcouF1uZ4gsC
Linked lists were also more applicable during that time.

The PC world was just starting to move away from segmented architecture to
32-bit linear addressing. With 64K segments, you were limited in how big an
array could be since it required contiguous memory. However, with linked
lists, since memory did not have to be contiguous, you were only limited by
available memory instead of 64K segments.

In addition, during the late 80's, early 90's the relative difference between
memory and CPU was much less than it is today. Because of this, iterating a
link list did not have quite the cost relative to iterating an array that it
does today.

Nowadays, linked lists are a much more specialty structure rather than the
first thing you reach for when you want to store a bunch of stuff.

------
chanux
Here is the unroll.

[https://threadreaderapp.com/thread/962424365819277312.html](https://threadreaderapp.com/thread/962424365819277312.html)

PS: After twitter started suffocating their app ecosystem, I can not find an
app that does threads well (at least on Android). So unroll helps a lot in
worthy threads.

~~~
penguin_booze
Thanks. I find it annoying when people write essays on Twitter.

------
curtis
The basic linked list algorithms are simple enough that a software engineer --
certainly one with a CS degree -- ought to be able to implement them from
first principles. And the point of the interview question isn't specifically
whether the interviewee can implement a simple linked list algorithm from
first principles, it's whether the interviewee can implement _anything_ from
first principles.

~~~
Jach
The question on the interviewee's mind is whether the interview is a proxy for
first principles ability or whether they really want you to implement such-
and-such exactly correctly. In principle I agree with you -- I had the
conversation recently that I have no idea how to implement a red-black tree
anymore and would probably fail a "balance a red-black tree when inserting X"
type of question, even though I had to do it perfectly in C++ in school. I'm
not even sure which color has which constraint by convention. But I more or
less remember the constraints, and as I talked through it I sort of remembered
how the constraints leads to self-balancing (and an approach to do it). Given
time and a responsive interviewer who can answer even dumb questions like
"red-black trees are defined to be binary trees right?" I could probably
produce something on a whiteboard, but I have my C++ code somewhere and I'm
pretty certain I couldn't reproduce that precisely on a whiteboard. What I
could do would satisfy some interviewers probably, but would not satisfy
others.

On the interviewer side of the table, if there's a particular property I want
to test for, then I'll try and test for it directly if it's possible. One such
property was "ability to make changes to a program one didn't write and can't
fit entirely in one's head" since that's the majority of employed work
(especially at larger companies) and I've had successes testing that directly
on intern candidates by having them do just that in a stripped down version of
part of some front-end code.

There are a lot of employed devs who seem to struggle with first principles. I
don't think it's a good thing and would want to filter on it for a company I
controlled from the start... But if we want to test for that specifically, I'm
not convinced data structure questions are a good way to do it. Since discrete
math should be a standard part of the curricula, I think asking for some
proofs of certain theorems given certain axioms and reminders of the rules of
inference would be more fruitful. But that would likely be even less popular
than linked list style questions. In the limit what I'd really be most
satisfied by in terms of having nice proxy measures on cognitive abilities
like first-principles reasoning, (system|task|...) decomposition, etc. would
be testing IQ and big-5 personality traits directly, plus interviewees should
only have to do it once (or at infrequent intervals) rather than every company
having their own process, though I think legally you'd have to pay the
Wonderlic tax to do it.

~~~
Joof
So where do I fit? (Very) High IQ, max openness, min consciensouseness.

You can also game big 5 and IQ.

~~~
Jach
If you could game big 5 and IQ the way people game other things, the world
would look a lot different... this isn't to say that on an old static test
like [http://iqtest.dk/main.swf](http://iqtest.dk/main.swf) you couldn't give
someone the answers or train them to perform better on raven matrices but
active researchers and I assume companies like Wonderlic aren't asleep on that
sort of thing.

If it were my company I'd take all the high IQ people I could get. I'd
probably learn to filter on other things too at the risk of everything blowing
up, but getting a lot of smart people together can also lead to amazing stuff
(that may not benefit me/the company, but hey). High conscientiousness is a
bonus for get-(business-relevant)-stuff-done efficiency, but I don't think
it's a hard requirement. I'm not "min" in conscientiousness but I am a slacker
below average, nevertheless I seem to get by and have generally kept
bosses/teams happy with my output levels.

I think you fit at a lot of companies that don't take those things into
account, too. High IQ alone is a big advantage for a lot of the other measures
(or gaming such measures) companies like to use. Though you might find a lot
of the work dull and/or feel lonely if there aren't any local peers to chat
with at your level. On the other hand tech salaries are high; I used to think
I might fall into a pattern of "work 1-3 years, take a year or two off
depleting savings, go back to work..." but then I realized if I just stretch
myself for a long enough continuous period (which isn't actually that long) I
ought to be able to "retire" and only go back to working for the Man by
choice.

------
sadness2
Getting asked to do any kind of fancy datastructure algorithm from memory
would put me off your company. It has very little correlation with any real-
world task. I'm very experienced and get a lot of shit done with high-load
systems requiring careful resource management, but I couldn't be bothered with
this. My portfolio should show you that I can do things.

~~~
temp129038
Curious...assuming you’re employed in a technical role did your interview not
include a technical interview that with data structure or algorithm qs?

~~~
sadness2
The last 3 technical roles I've been in over the last 8 years or so used
realistic technical tasks for the technical tests. It was grounded in actually
making something useful work. Intensive CPU/memory optimization is usually the
last thing to optimize in a system which is inefficient. When you do get to
it, you do it on a case-by-case basis with careful reference to the latest
work on efficiency in that particular sub-domain, not by instantly recalling
university lectures from 20 years ago. And by the way, the right solution for
CPU/Memory optimizations is never linked lists. I think the best technical
test you can do is pay your potential candidate to come and do a ticket with
your team. You actually get to see what working with them is like, as well as
practical ability. Failing that, give them some time to create a practical
solution to something a bit tricky, and see what their overall approach is
like, when given time to do it with stackoverflow etc. available to them,
because that's what real life is like.

~~~
actuator
Calling someone to work with your team is not scalable. It usually is preceded
by resume filtering which can be influenced by human biases.

------
shereadsthenews
I like how he casually asserts that most of "us" don't program in C even
though C and C++ are the #2 and #3 languages in the TIOBE Index today, after
Java. It's fifty times more popular than Rust or whatever trend he thinks his
friends are chasing.

~~~
actuator
The way TIOBE index ranks, a lot of C and C++ numbers are due to uni courses
dealing with it. But it is definitely much more used than something like than
Rust.

~~~
shereadsthenews
Sure the TIOBE Index is flawed. I wouldn't have even mentioned it but it forms
the basis of his argument.

~~~
hwayne
Yeah it absolutely sucks as a measure. You're better off manually counting
languages that appear in job postings. That gives you a better breakdown of
what people were actually hiring for.

------
yodon
Sites like HackerRank and TripleByte do a great job of telling me whether a
candidate has been studying to pass interview questions on HackerRank and
TripleByte.

They do very little to tell me whether, in the words of Joel Spolsky, they are
"smart and gets things done."

~~~
wolfgang42
I'm going through the Triplebyte process right now (I passed their interview
last month and have just started the bit where I talk with companies this
week) and that is not at all what they seemed to be testing. Their famous quiz
seemed to mostly be checking if you have any idea what you're doing[1], and
their two-hour interview[2] spent less than ten minutes on data structures. I
muddled through that bit by saying things that sounded plausible (with lots of
disclaimers that that was what I was doing and that I had no experience with
low-level code) and still passed it with flying colors. Having gone through
this process I would say that having some experience and being able to write
practical code is probably the best way to prepare, and studying interview
questions would probably be fairly ineffective.

[1] One of the incorrect answers was to use a factory function that passed the
data to an assembly line interface which put it in a package class and shipped
it to the user interface.

[2]
[https://triplebyte.com/interview_guide](https://triplebyte.com/interview_guide)

~~~
yodon
Thanks for this - I'm actually more familiar with more pure coder test
approaches like HackerRank and just mentioned TripleByte in the same breath
because they've been advertising their coding test heavily in parts of SF I
see (proving that at least some ad dollars do work to some extent).

------
optymizer
I personally find this content delivery method, where a small essay is split
into tweet blocks with links and unrelated imagery, very annoying to read and
ultimately disrespectful to the reader.

~~~
ken
Normally I find it frustrating to read a blog post as a sequence of tweets,
too, but in this case it seems appropriate.

(It doubles as a metaphor for why linked lists are generally a poorly
performing data structure on modern architectures.)

------
yardstick
For developer roles these days I tend to ask candidates what are the main
differences between Lists and Sets.

It’s an quick question to weed out most weaker candidates, and is more
relevant to the nature of our development: using data structures rather than
reinventing them.

~~~
ramraj07
People get this wrong? Like CS majors??

~~~
Jach
Interview enough people and you'll get people with Masters or PhDs in computer
science failing what seem to be trivial problems. Like FizzBuzz trivial. You
can find anecdotes on HN and other places...

My own personal worst experience is limited to a Masters in Physics who
couldn't code at all, code-like experience was limited to some sort of
software tool that some PMs might use to create acceptance tests. Though I
think a lot of these cases are just indications of a bigger problem higher up,
like HR or the hiring manager not adequately setting expectations of the job
role, or just not doing basic screening.

~~~
prepend
I once asked a person with an MSCS what a string was and they didn’t know. I
think it might be a language barrier thing so I asked the difference between
an array of characters and a string and again, no answer.

------
gregmac
To those who ask this type of question: What's been your experience with
people you hired this way?

Did everyone you hired who did well on these questions turn out to be good
hires? If not, why not?

If you took a chance and hired someone that maybe didn't do a great job on
these questions, did they turn out to be a good hire anyway? If so, why?

~~~
prepend
I don’t know with just this one question compared to others, but as part of a
suite of what I classify as “technical thinking questions” I think it’s
predicted well programmers who are mid level and up who can figure out
problems independent from languages or vendor solutions.

I never actually care about the literal code written and usually just ask for
pseudo code to understand the logic of how walk through it. So it will fit on
a white board or maybe sheet of paper and take maybe 5 minutes or 10 minutes
with commentary.

I think it’s better if the candidate has never actually written a linked list.

Similar questions I ask are “write a database connection pool” or fizz buzz.

They are parts screening as a surprising number of applicants can’t write
loops or even if statements, which is weird. And part seeing how they ask
questions to figure out what’s important requirements or assumptions or
limitations.

It’s probably worse, in my mind, to write out amazing code without asking
questions than to sketch out simple statements asking “how important is multi-
threading” or “what libraries can I use” or “where will this get called from?”

I don’t have an empirical litmus test from this, but for a few candidates who
sucked at this but still got the job, I regretted it. Although one or two
moved within the org out of programming to business analysis and project
management and did, I think, a good job.

------
morkfromork
Nothing like having to spend most of a time-limited interview going over
beginner coding and not touch on the actual skills required for the position.

~~~
taneq
You wouldn't do it if beginner coding wasn't required for the job.

~~~
morkfromork
It's a generic interview for a generic job at a generic company and then they
ask you why you want to work there. What do you love about Generic Inc.?

~~~
kthejoker2
Given the high demand for software devs, why on earth would you accept an
interview at a company and role you feel are generic?

------
thinkingkong
I love this type of analysis / retrospective. Ive done 100s of technical
interviews and so far there are a handful of questions that stand out as
highlighting great candidates.

\- the interviewer writes a simple c program that compiles and asks the
candidate what it does. The best example is an app that dereferences null.
Good developers see it right away and answer “segfault”.

\- ask someone to do something requiring managing delays, recursion, and error
handling. Its wild how few people can handle this who have been developing for
5+ years.

~~~
keithnz
I think its potentially bad the common thinking I've seen where an interviewer
( and I've fallen into this trap ) thinks "whoa! X years of development and
they can't do that! _shakes head slowly_ ". It's more a failure of the
interviewer to find out what the X years of experience entailed. They could be
insanely good at something really useful and just haven't coded many things
like your random coding problem.

~~~
duxup
At a technical but non programming job someone once told me "Man he doesn't
know what X is!"

My response, "The only reason I know that is because of that bug of ours that
keeps coming up..."

Some things just happen more some places and other things don't.

------
deepGem
Genuine question - who builds linked lists from scratch today ? The only place
I found where you had to build a linked list was in LRU cache.

Also who writes LRU cache from scratch as you have it already available in
Redis ?

What exactly does the understanding of LinkedLists prove - I mean I love
linked lists not because of their usefulness, because they are easy to reason
about and learn in somewhat an adaptive way. Other than that I'm curious to
know the actual usefulness of this skill as mostly you are using lists, deques
etc.

~~~
kd5bjo
Linked lists allow you to keep track of the order of items when you can’t
control their location for one reason or another, and tend to show up as one
part of a more complex structure—

For example, many garbage collectors use them to keep track of memory regions
that have been freed and can now be reused. I expect that they’re used
extensively in file system design to keep track of which blocks belong to
which file (if any). Maybe you need to keep track of multiple different sort
orders over a single set of objects.

------
thraxil
This all tracks with my memory and experience (dev since the 90s).

The other point that's missing to explain why it is so common is that one of
the early Spolsky articles that got a lot of attention at the time (early
2000's) and was very influential asserted that the two areas of programming
that seemed to "separate the men from the boys", so to speak, were pointers
and recursion. Ie, independent of how long someone had been programming or
what language/domain they mostly worked in, there was a tangible rift between
developers who deeply understood and could use those concepts and those who
didn't. If someone was comfortable with pointers and recursion, it was
considered a safe bet that they could pick up pretty much any other
concept/language/whatever without much trouble. Implementing linked lists was
a good demonstration that you could probably deal with the basic concept of
pointers.

Spolsky's argument was probably also born from the same experience of the
industry at the time. Before the first big dotcom boom, pretty much anyone
applying for a programming job who had a CS degree or previous job as a
programmer could mostly be assumed to be basically competent. It wasn't a
lucrative field so it self-selected for people who could understand
"difficult" concepts like that. Anyone who struggled too hard with those
would've changed majors or found easier work for better pay. It was mostly HR
and managers doing hiring and it mostly worked out because of that natural
filtering. After the dotcom boom, when programmers were seen to have high
salaries or become early millionaires, the market was flooded with developers
with inflated resumes that could talk their way past non-technical
interviewers but really had only "programmed" some HTML before and would
struggle to write a hello world program in Perl.

------
temp129038
I don’t really see a problem with LL questions. There’s only so many linked
list question variations and they are a simpler subset of trees/graphs, which
are useful and have more real world applications.

If I was interviewing I would be much happier if I was asked a LL question
over a tree or graph problem.

------
mycall
In the 80s, I overused double link-lists in Turbo Pascal. It was my quick-and-
dirty database block-storage of choice (minimize memory usage). Then I learned
about indexing and switched to dictionaries, btrees or red-black trees for
most things.

------
jldugger
This feels very post-hoc justification-ey. glibc has had data structures for a
good long while. I don't think they offer linked list, but it's not a
particularly useful datastructure compared to say, a hashtable.

~~~
Something1234
But a hash table using separate chaining requires linked lists, so still
pretty fundamental.

~~~
latch
And linked lists are the backbone of most persistent data structures and are
commonly used as a build block for a ton of things, like LRU caches, queues,
...

~~~
deathanatos
I agree w/ the LRU, but isn't a vector more efficient for building a queue?
(You use it as a ring-buffer. Push/pop are O(1) (amortized for push), and it
interacts well with the CPU cache since the memory is contiguous. And you get
O(1) indexing, too.)

Then there's the rather interesting datastructure that C++ has, std::deque,
which seems to get implemented as a vector of pointers to vectors. Still O(1)
push/pop/index.

------
piinbinary
I like to ask questions that involve implementing some small bit of logic on
top of a tree or graph data structure. Like the linked list questions, these
questions aren't as much testing problem solving or data structures as they
are testing whether you've recognized the trees/graphs in the data you worked
with recently || you remember working with those data structures from college
(which side of the || you fall on depends on your experience level). They're a
"can you code" question with a little bit of abstract thinking thrown in.

------
throwaway987665
Citation needed..

Is there any reference showing that this is the reason that people were asking
about linked lists?

There is the old joke that organic chemistry saved more lives than penicillin
by preventing dumb people from reaching med school. It’s a silly joke but it
rests on some correlation between the kind of thinking needed for this course
and needed to be successful doctor or medical student. If anything there is
probably a stronger correlation between the kind of thinking needed for basic
algorithms and data structure questions and the thinking needed to be a strong
programmer.

~~~
fwip
Not to be a downer on your joke, but if we had more doctors, medical care
might be cheaper, which would also save lives.

~~~
prepend
More doctors who kill people is probably a bad idea.

I had a joke about bad PMs...if you can be replaced by a spreadsheet in a
shared folder you are probably a bad PM.

I think having tons of bad doctors is probably a worse way to solve the high
price if medical care than just having better shifting of work within
healthcare to apps, therapists, telemedicine, and nurses.

Great PMs are awesome and way less important than great doctors since usually
people don’t die from non-great PMs.

------
libria
> I suspect this is because a large block of programmers were asked it and
> continued to ask it, unaware of how deeply tied to the historical context
> the question actually was.

Bad hires are expensive and false negatives are lost opportunity. The industry
is constantly looking for ways to improve its hiring. No old practice is off
limits.

Google no longer asks brainteasers [1]. Rumor has it Facebook discourages
dynamic programming now [2].

Yet somehow the author assumes that nobody ever thought to question the Linked
List because tee-hee unlike him we're all naive lemmings.

No, we do iterate on all our questions and remove the ones that don't
correlate well with results. We just continue to find linked lists to be a
decent predictor for now, at least no worse than other DS.

I do agree that all-or-nothing questions like cycle detection are poor, but
those kinds can be found in all data structures.

[1] [https://qz.com/96206/google-admits-those-infamous-
braintease...](https://qz.com/96206/google-admits-those-infamous-brainteasers-
were-completely-useless-for-hiring/)

[2] [https://www.teamblind.com/article/DP-questions-at-
Facebook-i...](https://www.teamblind.com/article/DP-questions-at-Facebook-
interview-rKhirgq2)

~~~
Sonnol53
This is great

------
rgoulter
I think it's interesting that "can you write a LL" allegedly made for a "hard
to fake" signal.

------
ignoramous
To play the devil's advocate:

> In other words, back in the 90's "how do you reverse a linked list" isn't
> about "algorithmic thinking" or "data structures", it's _have you coded in
> C_. If you have, the question is trivial. If you haven't, the question was
> (ideally) impossible.

It is still an interesting excercise to see if someone can code reversing a
string (array) and a linked-list, because they form the basic building block
of many other data structures, like hash-maps and trees. I doubt it has
anything to do with _clang_ , per second, than a fizzbuzz to relatively
difficult problems of solving for Graphs, for instance. So absolutely,
reversing a linked-list does have everything to do with data-structures.

> Take "determine if a linked list has a cycle in it." The solution people are
> supposed to come up with, "Tortoise and Hare", was AFAICT published in a
> heavily-cited 1967 research paper. You're asking a candidate to reinvent CS
> research in 30 minutes!

Well, multi-threading was a decade long research, if not more. Do you then
expect folks interviewing for Android Development, say, not know about
critical sections, race conditions, mutual exclusion, re-entrant locks et al
because these were ironed out over decades and decades of research? Guess not.

> Removed from the historical context, linked lists got rebranded as "problem
> solving skills". But this seems the opposite of what you'd expect from the
> original questions: if you're testing language familiarity, you DON'T want
> people to be able to fake it!

Sure, except if people got interviewed for language familiarity, one would
open a different can of worms. For instance, here's the internal details abt
trees and lists in Clojure (iirc):
[https://idea.popcount.org/2012-07-25-introduction-to-
hamt/](https://idea.popcount.org/2012-07-25-introduction-to-hamt/) and Rust's
HashTable:
[https://abseil.io/blog/20180927-swisstables](https://abseil.io/blog/20180927-swisstables)
How many folks could answer that? But I bet if we were testing for language
familiarity, these are the kinds of questions that'd creep in, which are even
arduous than the linked-lists.

Be careful for what you wish for. Solving the great tech interview problem
isn't straight forward, given by the numerous heated discussions over it over
the years, even here on news.yc:

"How to not hire a software engineer"
[https://news.ycombinator.com/item?id=19541617](https://news.ycombinator.com/item?id=19541617)

"60m interviews aren't enough"
[https://news.ycombinator.com/item?id=19811063](https://news.ycombinator.com/item?id=19811063)

"What do best interviewers have in common"
[https://news.ycombinator.com/item?id=15819198](https://news.ycombinator.com/item?id=15819198)

~~~
mattkrause
There’s a big difference between testing whether someone _already knows_
something vs. whether they can figure it out on the fly.

The tortise-and-hare algorithm conflates the two: if you’ve already heard of
it, it’s quite simple to implement. If not, it takes a flash of insight to
consider having two pointers chase each other through the list, one moving
multiplicatively faster than the other. I’d bet that flash didn’t come to
Floyd in the first 15 minutes he spent on the problem—-which certainly wasn’t
under pressure in an interview.

~~~
ignoramous
Sure. The problem with the argument I wanted to highlight wasn't the _puzzle_
nature of the solution, but the fact that the OP chose to instead focus on the
_research_ angle. I mean CSP, Actor Model, Lisp have strong foundations that
took a lot of research... as did everything else from Type Systems to Linkers
to Compilers. That said, I get your point too, I might have misunderstood OP.

------
bitwize
Because they're pretty much babby's first data structure. When I was a kid and
I needed to store the bag o' sprites for my first Windows 3.x game engine
(don't ask), I had the BRILLIANT idea to store pointers to the previous and
next sprite in each sprite, thus creating a doubly linked list with no formal
CS experience, nor exposure to that particular data structure. If somebody
knows thing one about programming that isn't dinking around in BASIC, it's
going to be linked lists.

