4 ms·
No, checking whether a list is sorted is O(n) ;). Bogosort is O(n) in the best case and O(inf) in the worst case).
by danieldk 11y ago
No, checking whether a list is sorted is O(n) ;).
Bogosort is O(n) in the best case and O(inf) in the worst case).
- lisivka 11y agoOptimize out the check, so it will be O(1) in some cases. ;)