Live data from Hacker News

Data structures and algorithms I actually used while working at tech companies

blog.pragmaticengineer.com

191–200 of 547 posts

Re: Data structures and algorithms I actually used while working at tech companies

#191
post #150

Earlier quoted context omitted.

I already don't want the job because of the interview process. Talking to someone about code they have written and the decisions and thinking around their own code is so much more respectful and gives better signal. You should be doing everything you can to put the candidate on their own turf and letting them shine. I have a lot of advice about interviews but one of the best I've heard over the years: whatever impres…

I agree with this 100%. I'd also like to add that because of this I adapted the traditional whiteboarding exercise at my current company to be about problem solving and design, and not about how many data structures you've memorized. When a candidate comes in, I give them a fake-yet-realistic product requirement (like count elements in a real-time stream from field sensors) and let them run with it however they see f…

I do something similar: I ask the candidate to take 30 minutes or so to design a system like an online library. What are the objects in the system, how do they relate, can you design a REST or graphQL API for CRUD operations.

Then if it’s a front-end position we can move onto UI components for it; for back-end or full stack I focus on implement a couple of the CRUD operations.

You really get to see how people think and will work on the job with questions like this.

Implementing a sorting algorithm from scratch is a waste of time in many projects: use your libraries and get on with life. That’s why such interview questions are not important to me.

Re: Data structures and algorithms I actually used while working at tech companies

#192

I'm not at all opposed to companies like Google, Facebook, etc asking Algorithms, Data Structure and Big O related questions. Why? It's very applicable to problems at their scale. That being said, not all engineers there work on such problems. If I'm asked to do a BFS/DFS, Tree traversal, etc for a small company.. I tend to share high level how I'll solve it then basically not actually code it up and say something li…

Generally, if you (as a small company) are copying FAANG interview process, you better be offering FAANG-level comp and benefits.

Re: Data structures and algorithms I actually used while working at tech companies

#193
post #22
post #10

I've used Dijkstra algorithm for calculating distance in a graph once. It was a highlight of that month. Of course I had to look it up(despite learning it and implementing it at university). Who remembers this stuff exactly after years of glueing libraries together? And even if you remember - won't you check it anyway just to be sure? It's OK to ask people general questions (what's algorithmic complexity, what kind o…

We always tell our candidates in advance what algorithms we'll be quizzing them on. And it's pretty much always: + fibbonacci + a sort + a linked list I like having candidates write out these problems on paper because it shows that they know how to think about code. Fibbonacci allows us to see that they have basic recursion understanding, and basic iterative loop understanding. Linked lists shows us that they underst…

This sounds like an inspection of whether the person has had a class in basic algorithms rather than if they have ever coded anything in real life.

In school I played with sorting algorithms, in business if I ever found a developer manually writing a sorting algorithm, I would consider them inept (unless there were very specific reasons to do so).

If someone didn’t know how to sort a list using the built in or standard library of whatever language they are using, I would know very quickly that they have almost no experience writing anything useful.

Re: Data structures and algorithms I actually used while working at tech companies

#194
post #22

Earlier quoted context omitted.

We always tell our candidates in advance what algorithms we'll be quizzing them on. And it's pretty much always: + fibbonacci + a sort + a linked list I like having candidates write out these problems on paper because it shows that they know how to think about code. Fibbonacci allows us to see that they have basic recursion understanding, and basic iterative loop understanding. Linked lists shows us that they underst…

Making people write code on paper is just ridiculous - way outside of testing and checking reality - and your reasoning of >"because it shows that they know how to think about code" means nothing at worst, and at best indicates you'll only be happy to work with people who are replicas of yourself. Take home is the way to go, unless the position is some sort of public exhibitionist analogue developer position. The lea…

The problem with take home interviews is that it could take one candidate an hour, and another every evening for a week.

Ideally the interviewer shouldn't be concerned about absolute code correctness, such as syntax or argument position, and should be interested more in how you're able to solve the problem, which should be a novel, yet simple task that doesn't require studying up on 200 level algorithms.

You want to hire developers (for permanent full time roles, at least) who have a good conceptual grasp of programming and logic, rather than their particular knowledge of a language or framework, or their ability to search on stackoverflow and run their code through a linter.

The worst interview problem I've been given was to write an AngularJS directive, I think literally to simply take an attribute and display it. I can't remember at the best of times the syntactical oddities of AngularJS, let alone when writing with pen and paper in an interview with no resources.

One of the better problems I was given was around parsing XML, from memory validating that opening tags matched closing tags, while allowing for self-closing tagsI remember the problem specifically didn't include any more complex facets of XML. Another was to reverse a string in-place ("hello world" -> "dlrow olleh"), and then to modify the algorithm to reverse the words but keep them in place ("hello world" -> "olleh dlrow"). Obviously in the real world you'd just use built in methods, but it's a problem that should be solvable without digging up your old lecture notes.

I've always felt comfortable writing code (or at least psuedocode) with a pen, but I think it's unfair to require a candidate to solve the problem on paper or whiteboard if they feel more comfortable typing on a computer instead, all that achieves is disadvantaging otherwise capable candidates who for one reason or another can't write code with a pen and paper. As long as they aren't googling "how to reverse a string in place", it immaterial what writing tool they use. If they feel more comfortable using a brush and papyrus, or carving a runestone, then that should be perfectly acceptable too (provided they bring their own writing material).

Re: Data structures and algorithms I actually used while working at tech companies

#195
post #22

Earlier quoted context omitted.

We always tell our candidates in advance what algorithms we'll be quizzing them on. And it's pretty much always: + fibbonacci + a sort + a linked list I like having candidates write out these problems on paper because it shows that they know how to think about code. Fibbonacci allows us to see that they have basic recursion understanding, and basic iterative loop understanding. Linked lists shows us that they underst…

"write out these problems on paper" I write on paper so infrequently that I actually find it pretty difficult to write more than a few words. I certainly wouldn't want to write something out longhand in an interview! Edit: It seems to me it would be rather unfair of me to ask people to write out their thoughts in Org Mode in VS Code just because that's how I happen to like writing notes :-)

I had to do a timed exercise to write code on paper IN PEN at a job interview. Talk about feeling like I had to get it correct the first time. Glad they didn't give me an offer because I would've had to consider accepting it.

Re: Data structures and algorithms I actually used while working at tech companies

#196

Earlier quoted context omitted.

>Lots of engineer types freeze when they have to make a presentation. I remember a meeting early in my career with literally three people in a conference room and I almost had a panic attack. That's definitely an unfortunate experience, but isn't giving presentations to explain your ideas - sometimes to people you don't really know - actually a significant part of the job? I'm an IC, and I present designs and project…

That’s not the same as on the spot coding challenges in a whiteboard though

You’re right. But what are you trying to prove with on the spot coding challenges? That the candidate can implement a hash table from scratch in 15 minutes with O(1) performance?

Is that something they’re going to do on the job? Very unlikely. So why are you not only testing for it but testing for it in a fake time-pressured stressful situation that also rarely exists on the job? (Yes , we all have deadlines but when are they ever 15 minutes on the spot?)

Perhaps you should have entered the education field where you could give such exams day after day to your heart’s content?

Re: Data structures and algorithms I actually used while working at tech companies

#197
post #64

A few years ago I spend lots of time and effort at Goldman Sachs solving a performance problem in a major part of their internal cloud infrastructure. The programme in question was running into performance problems, and a few smart people had already banged their head against a wall solving them. After lots of experiments and different approaches, my solution was to remove most of the advanced data structures that we…

Eric Lippert did a nice blog post on this sort of thing a few months ago: https://ericlippert.com/2020/03/27/new-grad-vs-senior-dev/

The other points he mentions, beyond constant factors, are that algorithms with great theoretical characteristics tend to interact really poorly with gross real-world considerations like the memory hierarchy, and that worst-case performance is not average-case performance.

Re: Data structures and algorithms I actually used while working at tech companies

#198
This article is hurting its credibility right from the get-go by un-critically reproducing yet again this tired saw from Max Howell:

> Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.

First, it's not remotely true that 90% of Google engineers use Homebrew, seeing as how almost all development is done on Linux (Max Howell is unjustifiably full of himself here). And secondly, he doesn't know why he wasn't hired, but it may well be because of the entitled attitude on display here rather than any coding shortcomings. No one wants to work with pompous rockstars. They may be fine for developing one-person projects out in the wild but they don't work well on team projects at large companies.

If you go into an interview with the attitude that the problems you're being asked to solve are beneath you and that you just flat-out deserve the job without having to prove yourself, your success rate is gonna be poor. To a big corporation, almost no one is as big of a deal as they might think they are, unless they hold a Turing Award or similar.

Re: Data structures and algorithms I actually used while working at tech companies

#200
post #81
post #67

Earlier quoted context omitted.

Writing speed isn't the bottleneck hopefully :)

It's not a matter of writing speed, it's familiarity. I've been programming for 30 years and I don't think I've ever written code down on paper. Why ask an interview candidate to do something they've never done before and will never do again? You might as well ask them to type their code using only one hand.

> I've been programming for 30 years and I don't think I've ever written code down on paper

I did it once or twice when I was 8 years old and didn’t have a computer yet :)

Post reply on HN