this post was submitted on 21 Mar 2026
798 points (98.2% liked)

Programmer Humor

30520 readers
842 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] TheseusNow@lemmy.zip 2 points 1 day ago* (last edited 1 day ago)

Exactly. Since n is represented by the collection of clothes, it is O(1) if you are only going through a finite subset of the clothes. If everything is in the closet, and in no particular order, you would then do O(n) because you potentially have to go through the entire collection to find one article of clothing.

It gets even worse if your idea of organization is placing the clothes neatly yet with no real order in a closet with multiple drawers and containers inside. In this last scenario you get O(n²) because you now have to repeatedly search through n numbers of clothing containers.