Live data from Hacker News

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

blog.pragmaticengineer.com

101–110 of 547 posts

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

#102
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 had a similar problem once and being an atypical programmer and did not know the term edit distance.

Some research gave me Levenshtein distance and from there I first used a naive perl implementation before finding that you could extend MySQL and found an example and implemented that.

Took me 1/2 a day to go from zero to working prototype

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

#103
As an average/below average engineer with 15 yoe who wouldn't pass SV-style interviews no matter how many leetcode problems I solve, I've only had to use algorithms a handful of times in my career.

One of the most memorable was when I had to build a graph from sql statements, parse the sql statements, determine the dependencies between the sql statements by traversing the syntax tree and ordering the graph based on the dependencies so sql statements on each level could be evaluated in parallel.

It was one of the most fun and interesting projects I've ever worked on, it took me a few days to come up with a Java implementation and after a few bugs I rewrote it in Scala. I think I ended up with some kind of DFS algorithm if I recall, I might give it a shot at implementing it from memory and putting it on github.

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

#104
post #82

Earlier quoted context omitted.

"You, Sir, are employing a double negative." -- Mr. Spock

Am I?

“You understand neither recursion nor Fibonacci”

Or

“You do not understand recursion nor Fibonacci”

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

#105
post #5

Would you rather be interviewed on algorithm questions or Ravens progressive matrices? They both test the same thing, but at least one you can study for, is somewhat relevant to the job (and is legal).

I have done that as a child high 120's low 130's IQ, - this was part of the investigation when I was diagnosed with Dyslexia.

Unfortunately some old school teachers whet not keen on dyslexia diagnosis

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

#106

Earlier quoted context omitted.

To filter out naive people that don't have proper understanding of fundamentals and just having some framework plumbing knowledge, I guess. These are considered pretty basic stuff that every programmer should know..

In my experience it's pretty necessary to do this. Probably depends on your local job market, but there are a shocking number of candidates that just don't know how to code. The explanation I've heard is that good devs generally get hired after only a handful of interviews, whereas really bad devs are going to do a lot more interviews on average before they get hired, so you get a pretty skewed sampling even if there…

I don't know what your hiring experience with this is, but there is an entire market around "coding interviews" where people will learn how to pass these. I found algorithmic interviews completely useless to assess junior engineers because of how many just learn just to pass interviews, but then have very little experience with real problems.

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

#107
post #66

Earlier quoted context omitted.

Fastest implementation is one non-recursive equation (which I had to look up) :) fib(n) = (((1 + sqrt(5)) / 2)^n - ((1 - sqrt(5)) / 2)^n) / sqrt(5) I even understood, once, how to arrive at the magic numbers :)

Derivation is here http://mathonline.wikidot.com/a-closed-form-of-the-fibonacci...

We've learnt on "discrete math" course at university how to derive closed form solutions to any similar recursive sequences using algebra and eigenvectors.

I remember that it's possible but I forgot all the required math :) Now that I googled it it's not THAT bad

https://medium.com/@andrew.chamberlain/the-linear-algebra-vi...

Of course the only use is to look smart once a decade when the subject comes up :)

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

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

[deleted]

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

#109

Earlier quoted context omitted.

At Caltech, we'd call that "brute force and ignorance" which is often the best solution. For example, Enzo Ferrari once said that the secret to better performance is more horsepower.

The actual quote was something like "aerodynamics are for people who can't build engines" which proves your point a bit better.

It's actually a bit ironic, because I consider Ferrari to build elegant cars while my old V8 Dodge is a triumph of brute force and ignorance. They're both great cars at opposite ends of the spectrum :-)

A variation on the sentiment I heard in a movie: "turbochargers are for wussies, real cars have cubic inches!"

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

#110
I like algorithms and coding competitions, but in my 22 year career in software engineering I have never had to code any algorithm myself, except in numerous job interviews.

As for data structures, the only one I occasionally need to code myself is a simple tree.

Post reply on HN