> [...] to explain to a developer why their code with 5 nested loops is probably not a good idea.
Funny anecdote about that:
I had written code with (in a nutshell) more than five nested loops because that's how password cracking works: try all the options. Someone in the presentation audience came from compsci education and asked if that isn't bad for performance. I really struggled to explain this basic logic of... like, yeah, it takes a while but what magic do you think exists to not do the password cracking algorithm (that indeed takes an indeterminate amount of time) yet get the password back from the hash (which was the objective of our research project)!
We got a good grade but I'm not sure if I was able to clear up this compsci student's confusion :p. They learned a theory but didn't know where to apply it
> However, in my experience, if an interviewer can't confirm basic knowledge of data structures and algorithms, then some lead ends up having to teach computer science [...]
Instead of making interviews a repeat of the exams that their diploma certifies, I'd suggest asking after the knowledge that you need/prefer them to have. E.g. we had a vacancy related to large-volume log data processing, so we gave people a challenge to answer simple questions about a large dataset which doesn't fit in RAM (e.g. "which city in the dataset had the most events"). The candidates, all in the last year or having finished compsci university, solved it in O(n) memory at best (some solutions were worse) instead of the O(1) solution¹ that seems obvious to me. They would, instead, split the dataset in a biased way and provide answers for the first slice only, often (not always) acknowledging it's a partial or biased solution and needs to be repeated for each slice, but not making the logical connection that if one can add up the results for the parts then maybe they could also just structure the code that way and process in a streaming manner for each record that comes in
I found it very insightful about candidates' ability to work with real-world data; that their algorithms class' theoretical knowledge doesn't translate if they haven't taught themselves that
Programming is commonly self-taught. I basically dropped out of high school to do a vocational school instead since I had already learned the basics, and there I'm not sure we covered algorithms for dealing with tree structures, I just know about that from the internet. In projects I've done for fun or for other jobs, it quickly becomes obvious which solutions perform and which ones don't. Looking up an existing algorithm to use is a lot quicker than knowing math theories and needing to learn programming from scratch still, so long as you know that performance in hot loops or UI threads is a thing to be aware of
¹ for(event in events){cities[event.city]++;} asort(cities);, excluding some wrapper code to e.g. associate event coordinates with a list of cities that we provided