Live data from Hacker News

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

blog.pragmaticengineer.com

31–40 of 547 posts

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

#31
I think it's nice knowing about analogous problems. If you know what you're trying to do is similar to NPC, one can quickly either dismiss the feature/problem, convert it to a problem with an existing solver, or maybe know that in general it's hard to solve but a relaxed variant is good enough.

I'd wish more of those problems showed up in my daily work, though.

Btw, a cool popsci book about algorithms occuring in day to day life is "Algorithms to live by".

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

#32
Let's say someone can solve the algo problem, what's that show?

Mostly that they prepared for an algorithms question.

It may be a good filter for 3rd-wave do-as-you're told programmers who stay in their lanes, produce by the book expected code, and just consistently obediently build things.

They wan better cogs for the corporate software machine.

If people are asking me algo questions, the job probably isn't right for me because my answer is "it depends". Last time I took one I was thinking "there's like 4 answer to this, what the fuck do you want?" it might as well have been "I'm thinking of a color" ... they have something written down and called it the "right" answer.

I gave a parallelizable answer, they wanted single threaded. I gave a single threaded one, they wanted 2 passes. I gave them a 2 pass version, they wanted one that didn't use collections.deque, I mean it was nonsense. "Guess what's on my piece of paper!" Cool beans bro.

Some people would have given them that answer the first time, I'm sure of it. Not me though. Not during the interview, not during the day-to-day.

I don't know how. I really don't. I don't know the right answers, all I see are a bunch of possibilities. That's why I'm first-wave.

The writer of homebrew isn't what Google is looking for anymore. His time to get hired there closed around 15 years ago. After the revolutionaries comes the administrators, a far less interesting but necessary entourage.

The people like me have all already quit. I've actually got nothing to offer them.

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

#33
post #7
post #4

I recently had an A-ha moment when I realized that the problem I was trying to solve admitted a simple solution with dynamic programming, something I had never used outside programming competitions. The problem was to divide a text into a number of tweets to make it a thread, with the obvious constraint that no tweet should have more than 280 characters, but you still wanted to minimize some cost based on how far you…

> no tweet should have more than 280 characters, but you still wanted to minimize some cost based on how far your tweets were from 280 chars That immediately brings Tex box badness to my mind. And the related line wrapping algorithm: http://www.tug.org/TUGboat/tb21-3/tb68fine.pdf

Yes, I was more or less inspired by TeX's algorithm.

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

#34
I've used Sort method several types both in Java and JavaScript but they way it's used it as a library function, I don't need to write my own sorting algorithm. Same for Data Structure commons ones I've used are found in Java Collections - ArrayList, LinkedList, HashMap, Set etc. For Deep Learning have used several algorithms that are best practices and common data structures like Tensors and Vectors. I realize the value of knowing the theoretical underpinning but practically speaking these are only ever written one by library creators, no idea why companies insist everyone to know these and implement by heart, they can ask much more interesting practical problems.

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

#35
post #34

I've used Sort method several types both in Java and JavaScript but they way it's used it as a library function, I don't need to write my own sorting algorithm. Same for Data Structure commons ones I've used are found in Java Collections - ArrayList, LinkedList, HashMap, Set etc. For Deep Learning have used several algorithms that are best practices and common data structures like Tensors and Vectors. I realize the v…

Java is an interesting one; while you don't write the sorting algorithm, you do write the sorting conditions, a function that returns a number depending on the compared values. Likewise there's hash functions, although in practice those will be generated by your IDE or Lombok. (I haven't been into Java for a while so there may be better alternatives, iirc Scala and / or Kotlin solve it as well)

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

#36
post #6

I once coded a function to calculate edit distance. It was the algorithmic highlight of my career :) But the general understanding of algorithms and complexity did help even in CRUD apps. It gives the bricks to form mental model of the underlying system. I don't need to code a b-tree but I may need to tweak its params.

I wrote a tree traversal algorithm to allow some custom logic to be specified in an external JSON that we didn't control... Felt great!

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

#37

Let's say someone can solve the algo problem, what's that show? Mostly that they prepared for an algorithms question. It may be a good filter for 3rd-wave do-as-you're told programmers who stay in their lanes, produce by the book expected code, and just consistently obediently build things. They wan better cogs for the corporate software machine. If people are asking me algo questions, the job probably isn't right fo…

If so, they're pushing "conformity" and "being a good cog in the machine" well past the point of cargo cult programming. That's what this algorithm-based interviewing is all about: a textbook cargo cult. And people wonder why they aren't seeing quality.

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

#38

Let's say someone can solve the algo problem, what's that show? Mostly that they prepared for an algorithms question. It may be a good filter for 3rd-wave do-as-you're told programmers who stay in their lanes, produce by the book expected code, and just consistently obediently build things. They wan better cogs for the corporate software machine. If people are asking me algo questions, the job probably isn't right fo…

Whenever I interview engineers, my main priority, beyond grasping whether they understand the stack they’ll be working with, is gauging how well they can work in an organization of fellow engineers, designers, and product folks to deliver a product and support the larger engineering team.

If they can pass that hurdle, you can almost be certain they know how and when crack open an algorithms textbook or use Google-fu to apply the right algorithm to solve a given problem.

(Knowing which data structures to reach for is far more applicable than being able to apply algorithms from memory. The article is good evidence of that.)

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

#39

Let's say someone can solve the algo problem, what's that show? Mostly that they prepared for an algorithms question. It may be a good filter for 3rd-wave do-as-you're told programmers who stay in their lanes, produce by the book expected code, and just consistently obediently build things. They wan better cogs for the corporate software machine. If people are asking me algo questions, the job probably isn't right fo…

This is like how every second kid in high school goes "I get bad grades because I'm too smart".

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

#40
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…

"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 :-)

Post reply on HN