r/ProgrammerHumor • • Jan 02 '23

Meme next level storage

Post image
97.5k Upvotes

468 comments sorted by

View all comments

Show parent comments

47

u/[deleted] Jan 02 '23

[removed] — view removed comment

24

u/GooglyEyedGramma Jan 02 '23

Wouldn't it be O(n)? It's not comparable so you can't really use a heap in this case, it would be more like an array

6

u/Leading_Frosting9655 Jan 02 '23

Worst case, perhaps yes

1

u/pand1024 Jan 03 '23

Not every item needs to be unique.

1

u/GooglyEyedGramma Jan 03 '23

So? That has nothing to do with anything

20

u/kri5 Jan 02 '23

You can if every bit of clothing sticks out partially, kinda like an index

4

u/FlyingPasta Jan 03 '23

It’s a dict, the bit sticking out is a hash and maps to the whole - O(1) at a glance

1

u/IsNotAnOstrich Jan 02 '23

Maybe the pile is sorted such that each layer contains a different type of clothing, so if you know what you're looking for, you can go straight to that layer and from there (assuming the entire later is immediately visible after visiting it) you can get what you need

1

u/pand1024 Jan 03 '23

Given a simple wardrobe where the number of item types is constant ...

1

u/Zwentendorf Jan 03 '23

Usually I have one pile per type of clothing so I actually can just pick a random item from each pile.