3 ms·
Exactly. O(1) FTW!
by yen223 13y ago
Exactly. O(1) FTW!
- rtpg 13y agowell 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)
- theseoafs 13y agoThis would be O(n), since the time it takes to pair your socks is still proportional to the number of socks you have
- yen223 13y agoThe 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).