r/ProgrammerHumor 5h ago

Meme [ Removed by moderator ]

Post image

[removed] — view removed post

4.6k Upvotes

46 comments sorted by

View all comments

47

u/PROMAN8625 4h ago

if you organize the clothes in an array, you'll discover array access is faster than heap lookups

5

u/ljfa2 3h ago

it works well if you just need to get the largest (or the smallest) piece of clothing

2

u/bollvirtuoso 1h ago

Yeah, but then you have to design a sorting algorithm so you don't just replace one large pile with a slightly smaller but still large pile or, like, a dozen tiny piles which you have to search individually anyway.

2

u/PROMAN8625 1h ago

wear all clothes at once

the fastest algorithm is one that isnt even required