News for hackers. Stuff that matters.
Re:Asana Engineering Interview Guide by tptacek on Monday March 28, 2016 @06:58PM (#11378145)
I agree with this sentiment wholeheartedly but bounds on balanced binary trees are worth knowing (like lookup, it's log n), since that fact is one of just two reasons you'd ordinarily ever use a tree.

However, I will offer you some Interview Candidate Self Defense, which I'll repeat from something I yelled on Twitter a few weeks ago:

If interviewers ask you about bounds for data structures, pick a fight with them over hash table complexity. If they believe it's O(1), argue it's worst case O(n). If they want you to say worst case O(n), argue that it's in the real world always O(1). It doesn't matter which is right, because these kinds of questions aren't about technology, they're about status signaling. Be the alpha nerd!

As a bonus: interviewers are evaluating you for X-factors like "confidence". You know who never got dinged in an interview for lacking "confidence"? The person who yelled at the interviewer about hash table complexity.

Re:Asana Engineering Interview Guide by Eratosthenes on Monday March 28, 2016 @09:48PM (#11378977)
Adopt an aggressive posture. Maintain eye contact and repeatedly say "amortized complexity".
Re:Asana Engineering Interview Guide by selimthegrim on Monday March 28, 2016 @09:54PM (#11378997)
The Illustrated Tech Interview Survival Guide would like a word with you.
Re:Asana Engineering Interview Guide by adrianN on Tuesday March 29, 2016 @04:32AM (#11380218)
If they say average case O(1), worst case O(n), hit them with them with O(log n / loglog n) with high probability from a simple balls-into-bins type argument.
Re:Asana Engineering Interview Guide by nialo on Tuesday March 29, 2016 @08:24AM (#11380921)
Could you expand on the balls-into-bins argument here? It's not quite obvious to me, but I'd really like to understand.
Re:Asana Engineering Interview Guide by adrianN on Tuesday March 29, 2016 @08:52AM (#11381041)
Items are balls, slots in your table are bins. Hash functions are assumed to distribute them randomly (uniformly). See also the Wikipedia article on Balls-into-Bins.

https://en.wikipedia.org/wiki/Balls_into_bins

This reference from the wiki is good http://www14.in.tum.de/personen/raab/publ/balls.pdf

Re:Asana Engineering Interview Guide by bertr4nd on Tuesday March 29, 2016 @12:08AM (#11379426)
I assume you mean this tongue-in-cheek, but someone yelling at me in an interview is probably not going to score well on the "Do I want to work with them?" X-factor.

Of course, a well-informed discussion of hash table complexity would be pretty fun to hear from a candidate. It's always great when I learn something new in an interview.

Re:Asana Engineering Interview Guide by tptacek on Tuesday March 29, 2016 @01:05AM (#11379585)
I'm like 60% tongue in cheek, because the reality is, for every interviewer who will filter you for being too aggressive, two more will filter you for lack of confidence.
Re:Asana Engineering Interview Guide by sulam on Tuesday March 29, 2016 @01:19AM (#11379619)
I have never once filtered someone for lacking confidence. I have never seen someone filtered for lack of confidence by any panel I've been on or any panel I was the hiring manager for. At this point in my career I have interviewed ~1000+ engineers.

I think you're interviewing with the wrong people, or at the wrong places. Way too many people treat interviewing as a way of demonstrating intelligence via computer science trivial pursuit. 5 minutes with Google will demolish 99% of the questions you might ask if all you care about is getting correct code on the board. The interesting part is the process and discussion the code creates, not whether or not they know the secret handshake.

Re:Asana Engineering Interview Guide by tptacek on Tuesday March 29, 2016 @01:32AM (#11379659)
That's nice, but I have literally read interview feedback from very smart interviewers at multiple companies that vetoed candidates because "they didn't appear confident". This isn't something I'm making up: it's a real problem.
Re:Asana Engineering Interview Guide by sulam on Tuesday March 29, 2016 @01:38AM (#11379685)
I think we can both agree that interviewing is overdue for a radical reboot. Silicon Valley, disrupt interviews, please!

That said, there are places that don't interview the way you describe. I'm equally sure there are places that do (I vividly remember my Dropbox interview). My hope has always been that Darwin's Law will apply to such places over the long run, but instead I think what actually happens is that as these organizations grow the interview process just ends up being a diluted version of the same BS, which translates into "lowering the bar." Nevermind that your bar was curvier than Lombard Street.

Re:Asana Engineering Interview Guide by nottestuser on Tuesday March 29, 2016 @08:25AM (#11380926)
"Silicon Valley, disrupt interviews, please!"

They did and that's the problem ;)

Re:Asana Engineering Interview Guide by dbt00 on Tuesday March 29, 2016 @12:14AM (#11379453)
This is mostly good advice -- it's worth knowing both worst case and amortized average time -- but plenty of interviewers will filter you if you're being an aggressive asshole, even if you're right about facts.

Make sure you're considering what the workday environment is like (something you can usually tell from the prep materials or discussions with recruiters) and acting the way you think you'd act in that environment.

Re:Asana Engineering Interview Guide by benwaffle on Tuesday March 29, 2016 @02:32AM (#11379845)
>If they believe it's O(1), argue it's worst case O(n)

In the case that all your keys have the same hash, right?

Re:Asana Engineering Interview Guide by Rapzid on Tuesday March 29, 2016 @04:28AM (#11380203)
It seems to me this would entirely depend on the implementation and how collisions are handled.
Re:Asana Engineering Interview Guide by sorokod on Tuesday March 29, 2016 @05:44AM (#11380431)
In Java 8, collisions in Maps are stored in a tree structure so worst case is O(log n)
Re:Asana Engineering Interview Guide by logicchains on Tuesday March 29, 2016 @07:20AM (#11380688)
Is it a balanced tree? If not, worst case could still be O(n).
Re:Asana Engineering Interview Guide by Rapzid on Tuesday March 29, 2016 @11:33AM (#11382194)
Haha, that would be an odd set of data indeed. I have no idea how they implement it but I hope I have made a point(I feel I have). I wouldn't be too impressed with an interviewer or interviewee arguing one side or the other about the complexity of "unspecified hashmap implementation".

Too clever by half.

Re:Asana Engineering Interview Guide by thaumasiotes on Tuesday March 29, 2016 @05:30AM (#11380379)
Buckets. :)
Re:Asana Engineering Interview Guide by mintplant on Tuesday March 29, 2016 @02:58AM (#11379936)
Right!