Interesting interview questions:
Q: What's a fast way to divide an integer by 7
using the bit shift operator? (apparently asked by an EA Sports interviewer)
A: I thought about this for a bit and came up
with the following estimation:
r = (x >> 2) - (x >> 3) + (x >> 6);
I mostly mention this because I had my own interview today where I felt... well, less than adequate. Suffice it to say, my ability to figure out the Big-O notation for algorithms was less than stellar. I was also unable to come up with a solution for his webcrawler scenario, which was along the lines of "if you've got some huge number of pages to crawl, how could you prevent the crawler from scanning the same page multiple times?" to which I had to admit to him, I hadn't the slightest idea how to go about it (the prelude to this question had been "the simplest way to do such a thing if memory was not an issue" to which I replied I'd use a hash table, using the page urls as the key).
