Lossy sort
this post was submitted on 28 Jan 2024
177 points (100.0% liked)
Programmer Humor
418 readers
32 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
Besides the obvious flaws... is that parameter a list named list
, shadowing the list()
constructor?
you can even have a case where you return the first element of the list if the list is not empty, and it will still be O(1).
you can make it sort the first k elements and it will still be O(1). Set k high enough and it might even be useful
By that logic, any sorting implementation is O(1), as the indexing variable/address type has limited size