Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
yen223
· 12y ago · 0 comments
Exactly. O(1) FTW!
Comments
[–]
rtpg
12y ago
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)
[–]
theseoafs
12y ago
This would be O(n), since the time it takes to pair your socks is still proportional to the number of socks you have
[–]
yen223
OP
12y ago
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).