You're viewing a single thread.
All comments
27
comments
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).
8 0 Replyyou 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
12 0 ReplyI set k to 50,000,000,000... that's more items than my shitty computer can fit in memory (including swsp) but I am now happy to celebrate my O(1) algorithm.
5 0 ReplyBy that logic, any sorting implementation is O(1), as the indexing variable/address type has limited size
2 0 Reply
27
comments
Scroll to top