Wednesday, August 25, 2004

Let's say you have eight balls. They're all exactly the same, except that one of them is heavier than the other seven. You have a balance; how many times do you have to weigh the balls to figure out which is the heavier one?

Now, I was sitting in a barren room — just a desk, a phone, two chairs, and an interviewer — being put on the spot with this stupid academic question. "Have you done any work with distributed computing?" No.

"Have you done any work with deadlocks?" What does that even mean? Is he asking me if I've ever had to debug a deadlock? Just theoretical work. In my operating systems class.

"How good are you with algorithms?" Unquantifiably good? "Let's say you have eight balls...."

Hmmm, Interviewer Guy, maybe I'd be able to puzzle out this question if I weren't under pressure here. But instead, no, I look like a fool. I kind of feel like I just wasted the interviewer's time.

By the way, the answer's the base-2 logarithm of eight, which is three. I should've known. In algorithm analysis, the answer's always the base-2 logarithm.

0 comments: