Where Are All the Qualified Programmers?
blog.slickedit.com
blog.slickedit.com
Of course, when most industry executives complain about a programmer shortage what they really mean is they are having trouble finding smart, experienced people who will work long hours on boring projects for low pay. Imagine that.
As an example, imagine that Web Development was so difficult that only one programmer on earth could pull it off. Maybe that programmer would get paid millions or even billions, but there sure as hell would not be as many useful web applications around as there are today.
A lot of people have pointed this out - it actually takes quite a bit of talent to write reasonably unbuggy code that updates payroll from the eight different departmental database systems. It's just terribly boring, and not especially well paid, so the people with this kind of talent either do other things in the software world, or don't work in software at all.
In the long run the market might try to provide more food, but perhaps there simply is a limit to the amount of food that can be provided.
Likewise for good programmers - maybe the amount of people who are intelligent enough is severely limited? Although I suppose woith 6 billion people, there should be the one or other with sufficient brains...
The fundamental point is that if there really were a shortage of programmers then programmer compensation would be rapidly increasing. However, industry data shows that average compensation is increasing at only slightly more than the rate of inflation. Therefore, there can't possibly be a shortage right now.
Interesting point about the compensation rates, but I'd like to think more about the issue before accepting the argument (note that I don't claim that there is a shortage of programmers).
Good programmers don't want to work at dull jobs in large companies (though there are some exceptions, e.g. for i-banks, hedge funds, etc., since people will tolerate dull tasks for substantially better than average pay).
You hard-code it using XOR. Note you can't even do a for-loop, as that's using an extra variable. Of course hand-unrolling a loop takes extra memory because it's so many extra lines so there's no point.
a ^= b
b ^= a
a ^= b
This is very unlikely to be something that occurs to programmers who haven't had to XOR recently; if you aren't writing your own hash or crypto or codec functions then you probably haven't used it in a while. Now that you've seen this, you'll remember it and so if anyone asks, you won't be figuring it out again, just recalling.IMO it's a pretty useless way to weed people out, kind of like testing people on chess by random arrangements of pieces. Chess experts remember actual legal positions that occur in games much better than non-players, but they are no better at remembering positions that never occur -- a bunch of kings on a chessboard, some in adjacent squares, for example.
Likewise, this kind of pattern NEVER occurs in what most people program; it's just implausible.
But I agree that it's a bad interview question.
Write it out to see.
So it still doesn't work, even if you use a function to "cheat" and get a "free" pointer (which, by the way, wasn't what the task said).
Here it is with a 4-element array, a[0] through a[3]:
a=[100,200,300,400]
a[0] ^= a[3]
a[3] ^= a[0]
a[0] ^= a[3]
a[1] ^= a[2]
a[2] ^= a[1]
a[1] ^= a[2]
a
[400, 300, 200, 100]
(Pretend this list is an array, it's just for illustrative purposes)http://www.lysator.liu.se/faq/c-faq/c-2.html
The general point is that interviews of this type are counterproductive.
If you want to posit any kind of sane question, then you can have a sane solution.
That's what I said a few posts ago.
> You can't claim to have a solution for the problem if it only works for a
> fixed input, and if the solution itself would be different for different
> inputs.
"Reverse this array". Done. "Reverse an unspecified array of arbitrary length" is a different problem :)