News for hackers. Stuff that matters.
Re:How to pair socks from a pile efficiently? by yen223 on Tuesday April 29, 2014 @09:08AM (#7666667)
Exactly. O(1) FTW!
Re:How to pair socks from a pile efficiently? by rtpg on Tuesday April 29, 2014 @09:39AM (#7666864)
well considering that the number of socks is limited by the number of atoms in the universe, we can make pretty much any time-bound algorithm O(1)
Re:How to pair socks from a pile efficiently? by theseoafs on Tuesday April 29, 2014 @10:56AM (#7667375)
This would be O(n), since the time it takes to pair your socks is still proportional to the number of socks you have
Re:How to pair socks from a pile efficiently? by yen223 on Tuesday April 29, 2014 @07:41PM (#7670659)
The idea is that I don't need to pair my socks. I can just take any random 2 socks from the heap whenever I'm going out, since they are all the same. Hence, O(1).