News for hackers. Stuff that matters.
Re:Big-O Algorithm Complexity Cheat Sheet by algorias on Saturday May 04, 2013 @11:27AM (#5655183)
This is why it's a terrible idea to ask for some random algorithm runtime in an interview. It says absolutely nothing about programming or reasoning skill.

I'd rather ask a candidate to explain their favorite data structure to me and derive it's big-O complexity right then and there. Being able to regurgitate the correct answer doesn't count for anything in my book.

Re:Big-O Algorithm Complexity Cheat Sheet by fatemayasmine on Saturday May 04, 2013 @11:58AM (#5655263)
Often the followup question to what is the O notation of X is why? So if you are just going to memorize the cheat sheet then it won't get you very far.

It is good to know what you should know about though.

Re:Big-O Algorithm Complexity Cheat Sheet by dllthomas on Saturday May 04, 2013 @01:26PM (#5655566)
I was asked the O() of binary search. I said "log n". They asked "what base?"

... obviously they wanted 2, but O() doesn't work that way - changing base is a constant factor. Sometimes there's a tension between figuring out someone's understanding of the algorithm and someone's understanding of the notation (and math behind it). Of course, I gave them both answers...

Re:Big-O Algorithm Complexity Cheat Sheet by ot on Saturday May 04, 2013 @05:38PM (#5656405)
> changing base is a constant factor.

Only if the base is constant. For example B-trees have O(log_B n)-time operations, and you can't ignore the B because it is a parameter (hence non-constant).

Re:Big-O Algorithm Complexity Cheat Sheet by crossroads091 on Saturday May 04, 2013 @04:54PM (#5656281)
What was the second answer?
Re:Big-O Algorithm Complexity Cheat Sheet by bastijn on Saturday May 04, 2013 @05:31PM (#5656384)
2 and the "no need for base in big-O" makes 2 :).
Re:Big-O Algorithm Complexity Cheat Sheet by saraid216 on Saturday May 04, 2013 @04:20PM (#5656186)
Maybe they wanted both answers?
Re:Big-O Algorithm Complexity Cheat Sheet by blt on Saturday May 04, 2013 @08:03PM (#5656825)
Favorite data structure, that's a funny idea. Like asking a candidate to explain their favorite size of wrench.