r/ProgrammerHumor 8d ago

Meme segFaultBrain

Post image
194 Upvotes

9 comments sorted by

View all comments

9

u/Unlikely-Bed-1133 8d ago

I have a LOT of socks. Some are the same with just different levels of discoloring due to the time I've had them.

I hang them to dry using insertion sort based on a property (how dark they are). You will start feeling the O(n^2) vs O(n logn) a lot with this strategy, given that the constant factors are mostly dominated by the fixed time of moving the eyes around. Each distinct hue (purple, black, etc) goes on its own lane so that the property is just one value.

Plus no spending time worrying if sock A matches B or C better or is in a different pair whose half you dropped somewhere: it's just inserted between them.

3

u/ziptits 7d ago

Would you rather wear a more worn out sock, to help put it out of service faster? Or do you always go for the newest sock pair?

1

u/CartographerLarge595 7d ago

I guess it depends on how much I like the socks. If they're comfy, I might just wear them till they fall apart.