Insomnia Log

This is what keeps me awake at night???

Who needs sleep? (well you’re never gonna get it)
Who needs sleep? (tell me what’s that for)
Who needs sleep? (be happy with what you’re getting,
There’s a guy who’s been awake since the second world war)

-- words and music by Steven Page & Ed Robertson

Name:
Location: Boulder, Colorado, United States

Everything you need to know about me can be found in my posts

Thursday, December 20, 2007

Obama is Greater than McCain

Senator Barack Obama recently had a job interview, I mean spoke, at Google, hoping to impress the nerd crowd. And, just like he did previously with Senator McCain, CEO Eric Schmidt asked a trick technical question, although slightly differently this time. No doubt he read my criticisms of his earlier question and tried to tune it up a bit.

As I wrote, McCain lost a good opportunity to profit off his version of the question, "How do you determine good ways of sorting 1 million 32-bit integers in two megabytes of RAM?" He merely laughed it off. But, when Obama was asked for "the most efficient way to sort a million 32-bit integers", he actually made a reasonable but incomplete answer, "I think the bubble sort would be the wrong way to go."

Of course, Obama must have read my earlier blog post and knew that a question like this might be asked. He probably also prepared his answer in advance. But still, he didn't actually answer the question, he merely listed one incorrect answer.

So, what is the right answer. Well, Schmidt again didn't define all his terms. Primarily he didn't say what he meant by "efficient".

Well, to me, efficient means it takes me the least amount of time. So, if I were to be asked this question, the answer would obviously be, load the numbers into Excel and select the Data Sort menu option.

But that is probably not the right answer for candidate Obama. It would depend on exactly what the numbers are and why they needed to be sorted, but in most cases the best method would be to tell one of his interns to sort the numbers and come back with just the top three.

By the way, in my earlier post I said:
Full disclosure. This log is hosted by Blogger, which is owned by Google. So, if this post never shows up in any Google searches, I think I'll know why.
Well, it turns out that there was a huge spike in the number of people visiting my blog with search terms related to sorting of integers right around the time of Obama's interview. This can only mean that the folks at Google are using my blog to help them write better interview questions.

Does this mean I get a cut of the referral bonus?

And, Mayor Giuliani, are you paying attention?

Labels: , , , ,

1 Comments:

Anonymous Yousif said...

if you are looking for the answer, I would guess you'd implement a modified mergesort algorithm...
* copy half the numbers to memory
* merge sort them
* store and overwrite to persistent storage
* copy other half to memory
* merge sort them
* store and overwrite to persistent storage
* merge two portions in persistent storage by comparing the n value of the first portion with the n of the second and switching their position.

Tue Jan 15, 12:37:00 PM  

Post a Comment

<< Home