Live data from Hacker News

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

blog.pragmaticengineer.com

21–30 of 547 posts

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

#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 understand pointers. And a sort shows us that you can structure more complex code well.

If you truly want the job, you'll take 15 minutes the night before to remind yourself how all of these things work, none of them should be particularly foreign or confusing to an experienced programmer.

That covers the coding part of our interview. For the problem solving part of the interview, we may give you problems that require using heaps or skiplists or graph algorithms, but for this part of the interview we're happy to let you import imaginary libraries that do all the hard work.

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

#23
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, dynamic programming is how I implemented line wrapping for (the help text in) SingStar PS3 also.

Good spotting BTW, the line wrapping algorithm (where each tweet is a "line") is a perfect match for the post you are responding to.

When doing programming competitions, you're often trying to figure out what standard algorithm is similar to the problem and how you need to tweak it to match.

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

#24
post #20

I once thought it would be difficult for big tech company recruiting processes to tell the difference between: a) A really good problem solver b) Someone who has ran through all the example interview problems on leetcode or something similar Then I thought that this might be similar to the Turing test. Once you’re that good at faking it that you can convince someone else - maybe the difference doesn’t matter at that…

Working through a lot of problems will make you a better problem solver because the techniques can often be generalized.

I just don't think it makes sense to test people on this kind of questions and then make them write CRUD all day.

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

#25
I have used graph algorithms a little bit at work. For example if you are generating code for a language like C where order of declaration matters, you can use a directed graph to represent dependencies between data types and then use a topological sort to order how you write structs to the header file.

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

#26
post #20

I once thought it would be difficult for big tech company recruiting processes to tell the difference between: a) A really good problem solver b) Someone who has ran through all the example interview problems on leetcode or something similar Then I thought that this might be similar to the Turing test. Once you’re that good at faking it that you can convince someone else - maybe the difference doesn’t matter at that…

[deleted]

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

#27
I've done an awful lot of investment in booktime to learn various algos, simple to obscure, and frankly never used any of them. I do find that depressing.

What people seem to want is big-data or various tech stacks. I look forward to the time I can put even a bloom filter to work.

(edit: typo)

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

#28

A good wood worker tends to know the tools of the trades and more importantly know when to not use a tool and when to invent a new one.. That said not every cabinet is a work of art some are just there to be functional for long enough to justify their creation. I feel system interviews that dive deep about decisions and insights are far more useful than hitting a leetcode jackpot. Though it puts a high bar on the int…

Most wood workers likely won’t know or care how to build their tools from scratch

In the sense of going from rocks to iron to steel to finished tool, no, but otherwise, yes. Making specialised saws, scrapers, chisels, spokeshaves, planes and so forth are part of the luthier's, cabinetmaker's, and shipwright's existence. And that's just the tools, leaving workholding aside. Add in jigs and fixtures and there's a whole lot more. Not everything you need to do the job can be had off the shelf.

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

#29
One algorithm I keep coming back to is Aho-Corasick, which locates all occurrences of a set of keywords in a string of text in linear time. (https://github.com/ahnick/ahocorasick) It's been useful anytime I needed to locate patterns in a group and I didn't want to be looping back over the group repeatedly.
Post reply on HN