in reply to Need crash course in PERL!

Instead of complaining about how unfair the test is, consider it a challenge (although judged on this post, it looks like you've failed already). Give it your best shot. Approach it with humour.

Ten years ago, when I was hiring C/Pascal developers, I used the company-supplied programming test to winnow out the candidates. One of the questions asked the applicant to write a bubble sort in C.

I know, I can hear you saying "But the bubble sort's the least efficient!" and you can tell me it's O(n^2) in the worst case. Yes, I know that.

But that's not the point. Nor is it pertinent to point out that Linux/Unix has a sort command. I specifically asked for a bubble sort.

I really liked one applicant, but he'd coded up a quicksort solution. I was impressed, and I typed it in and it compiled and ran flawlessly. But I didn't hire him, because I'd specifically asked for a bubble sort.

An interview is a contrived social situation: when you're asked to do something in a particular way, my strong advice is to just do it the way the interviewer asks. Follow up with clever alternatives later.

Sometimes they're interested in your answer, and sometimes they just want to see how you react. Like asking how many golf balls fit into a station wagon. Of course it's a ridiculous question. Do you complain about it, or do you start with a joke about what a great prank that would be, then come up with some rough approximation?

So why the bubble sort? Because I can describe the algorithim quickly, and the code (two nested for loops) can be dashed off in about five minutes.

And the candidate who wrote that great quicksort routine? I didn't hire him - I knew that if I hired him and then gave him specific instructions to do something a particular way, he'd probably do it 'more efficiently' and therefore incorrectly for the required task, then he'd have to do it again, making us both unhappy with the outcome.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^2: Need crash course in PERL!
by bart (Canon) on Aug 27, 2008 at 20:33 UTC
    One of the questions asked the applicant to write a bubble sort in C.
    I don't know Bubble Sort. I have seen it some time, years ago, but I don't care much about learning algorithms by heart, so I don't remember how it goes. I wouldn't recognize a Bubble Sort if it hit me in the face. Neither would I recognize a Quicksort.

    Does that make me a bad programmer? According to your test, I am.

    Perhaps your candidate was not being a smartass. Maybe he was like me, doesn't know any sorting algorithms by name, but he does know enough to write a program that works. So maybe he was just trying to make the best of a poor situation, trying to write any sorting function that works. And he succeeded.

    And you threw away a likely very fine candidate, just because he doesn't think like you. Instead, you think you have him all figured out. Shame on you.

    But I could be wrong, thinking he might have been thinking like me.

        I don't know Bubble Sort. .. Does that make me a bad programmer? According to your test, I am.

      Nope -- you never saw my carefully defined paragraph describing the bubble sort. I won't try to replicate it here, but I can assure you would have been able to read and understand it.

        Perhaps your candidate was not being a smartass. Maybe he was like me, doesn't know any sorting algorithms by name, but he does know enough to write a program that works. So maybe he was just trying to make the best of a poor situation, trying to write any sorting function that works. And he succeeded.

      I guess we'll have to agree to disagree on that one.

        And you threw away a likely very fine candidate, just because he doesn't think like you. Instead, you think you have him all figured out. Shame on you.

      I had to make a decision based on the limited amount of information I had, and in a limited amount of time. I was constrained by a number of other items -- the pay wasn't that great, yet I was trying to fill a position that required decent C and Pascal, knowledge of data communications, as well as the ability to perform second line customer support and occasionally carry a pager. It was hard to find candidates that met all of those criteria.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        Nope -- you never saw my carefully defined paragraph describing the bubble sort.
        Aha... So you described the Bubble Sort in words, and asked to convert it to code...? That is something else... At least, "I'm not sure which sorting algorithm is Bubble Sort" is no longer a good excuse.
Re^2: Need crash course in PERL!
by Anonymous Monk on Aug 28, 2008 at 02:41 UTC
    And the candidate who wrote that great quicksort routine? I didn't hire him - I knew that if I hired him and then gave him specific instructions to do something a particular way, he'd probably do it 'more efficiently' and therefore incorrectly for the required task, then he'd have to do it again, making us both unhappy with the outcome.

    That sounds like a whole lot of manure.