Here's the transcript:
SCHMIDT: Now, Senator, you're here at Google and I like to think of the presidency as a job interview. Now, it's hard to get a job as president. And--I mean, you're going to do a great job. It's also hard to get a job at Google. We have questions and we ask our candidates questions. And this one is from Larry Schwimmer. What--you guys think I'm kidding, it's right here. What is the most efficient way to sort a million 32-bit integers?
SCHMIDT: Maybe--I'm sorry...
OBAMA: No, no, no, no. I think--I think the bubble sort would be the wrong way to go.
SCHMIDT: [facepalm] Come on. Who told him this? Okay. I didn't see computer science in your background.
OBAMA: We've got our spies in there.
All in all, it was a very unexpected answer from Obama with perfect delivery.
 Nervous laughter greeted the mention of a Larry Schwimmer question, because he once asked Jimmy Carter about his UFO encounter.
 Eric Schmidt had asked the sorting question to John McCain on a different visit, with the expected result. See the YouTube clip of McCain's visit.