Barack Obama – Computer Science Question

Barack Obama gets asked a computer science question by Google CEO Eric Schmidt.

Comments

  1. torgausen says:

    You must look at all the numbers, but I guess it could be done with a special xmm instruction that sorts its 32bit ints in a single clock cycle (hence O(1)) if the chip producers would consider it worthwile.

  2. kormoc says:

    Your calculations for big O cost is incorrect for sorting 3 items in O(1). Please write a generic algorithm that will take any three numbers and sort them correctly in one operation without scanning all three of them.

  3. torgausen says:

    Have another look at the problem. Obama is asked to sort a constant number of items (1,000,000). So if you want to call this constant “n”, then “n” is in this case 1,000,000. Hence bubblesort will run in O(1,000,000^2 / 2) which is in O(1), if you interpret the math correctly. Or look at it this way: can you not sort 3 items in O(1)? Why not 5 items then? What is the biggest constant number of items you can sort in O(1)?

  4. Watchdawg says:

    @ChristopherDone Exactly.

  5. ChristopherDone says:

    They obviously set him up with it before hand.

  6. clamberson says:

    You don’t understand Big-O notation, do you? No biggie, but you should read up on it ;-)

    Bubble sort is still most definitely O(n^2)

  7. amara01addis says:

    What. The. Fuck?

    n….is a constant?!

  8. torgausen says:

    To be extremely pedantic, any sorting algorithm for this problem would run in O(1), since n is a constant (1,000,000). And I love to pedantic ^ ^

  9. reinux says:

    depends on whether or not the data can be assumed to be mostly sorted, and whether or not the data is IO bound.

    “bubblesort is the wrong way to go” is a more correct answer than “quicksort” :)

  10. andrefaramir says:

    wow, pergunta pro lula agora HUASHUADHUASD

  11. AbbeeNges3 says:

    lolwarmhearted girl who is searching for a man who would be able to satisfy my needs

  12. ahgaming says:

    whose stupid idea is it to ask him this? u really expect him to be able to know? or ur just trying to embarass him?

  13. nuttall2007 says:

    Hmm, i find Obama quite shallow and pedantic, yes…

  14. byScrooby says:

    Quick! Google ‘God: hidden science’

  15. AlgeKalipso says:

    That’s how I always do it!
    Too bad my algorithms rarely finish during the lifetime of the universe.

  16. I wouldn’t say I agree 100% regarding certain issues, but you’ve got an interesting point of view. Anyway, I like the quality you add to the blogosphere and that this isn’t just another abandoned, made-for-adsense blog! Take care…

  17. AlgeKalipso says:

    CombSort – a slight modification of quicksort would do it as good as quicksort (O(n lg n )). Regardless… Thumbs up for Obama!

  18. tripjet999 says:

    If it’s written in ztec code, a surface-slot sort would be faster than almost anything else.

  19. b2bhupesh says:

    tis

  20. benisunci says:

    Randomized Quick Sort

  21. aknight9 says:

    Quick Sort!

  22. sniperboy102 says:

    so whats the answer to it ?

  23. torgausen says:

    Luckysort is the most efficient way. It’s O(0) and also very easy to implement. It does require some luck though.

  24. Onix64 says:

    LOL Obama rocks!!

  25. MrTrajan69 says:

    where da jobs is?

  26. foodeater02 says:

    I think insertion sort can still pull through and win this thing.

  27. It appears that you’ve put a good amount of effort into your article and I demand a lot more of these on the World Wide Web these days. I truly got a kick out of your post. I do not have a bunch to to say in reply, I only wanted to register to say phenomenal work.

Speak Your Mind