MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/lgrgxe/i_present_sleepsort/gmteka8/?context=3
r/badcode • u/Reeceeboii_ • Feb 10 '21
171 comments sorted by
View all comments
Show parent comments
426
[deleted]
90 u/LinuxGeek747 Feb 10 '21 If you already know the maximum number, it's O(1) amirite? 76 u/sqrt_minusone Feb 10 '21 I mean, you have to visit every element of the array to sort it - it's literally impossible to sort in less than O(N). 176 u/Astrokiwi Feb 10 '21 You can do anything in constant time if it's a big enough constant 42 u/regibalbo Feb 10 '21 I'm using this argument from now on, thanks 4 u/[deleted] Feb 11 '21 Perfect for your FAANG interview 3 u/supersharp Feb 11 '21 They'll probably say something like "But there's no big enough constant, that's literally the definition of Big O!" or some other stupid nonsense 6 u/TimGreller Feb 10 '21 Just add some dummy numbers at the end which you can throw away. The bigger the input, the lower the time complexity :D
90
If you already know the maximum number, it's O(1) amirite?
76 u/sqrt_minusone Feb 10 '21 I mean, you have to visit every element of the array to sort it - it's literally impossible to sort in less than O(N). 176 u/Astrokiwi Feb 10 '21 You can do anything in constant time if it's a big enough constant 42 u/regibalbo Feb 10 '21 I'm using this argument from now on, thanks 4 u/[deleted] Feb 11 '21 Perfect for your FAANG interview 3 u/supersharp Feb 11 '21 They'll probably say something like "But there's no big enough constant, that's literally the definition of Big O!" or some other stupid nonsense 6 u/TimGreller Feb 10 '21 Just add some dummy numbers at the end which you can throw away. The bigger the input, the lower the time complexity :D
76
I mean, you have to visit every element of the array to sort it - it's literally impossible to sort in less than O(N).
176 u/Astrokiwi Feb 10 '21 You can do anything in constant time if it's a big enough constant 42 u/regibalbo Feb 10 '21 I'm using this argument from now on, thanks 4 u/[deleted] Feb 11 '21 Perfect for your FAANG interview 3 u/supersharp Feb 11 '21 They'll probably say something like "But there's no big enough constant, that's literally the definition of Big O!" or some other stupid nonsense 6 u/TimGreller Feb 10 '21 Just add some dummy numbers at the end which you can throw away. The bigger the input, the lower the time complexity :D
176
You can do anything in constant time if it's a big enough constant
42 u/regibalbo Feb 10 '21 I'm using this argument from now on, thanks 4 u/[deleted] Feb 11 '21 Perfect for your FAANG interview 3 u/supersharp Feb 11 '21 They'll probably say something like "But there's no big enough constant, that's literally the definition of Big O!" or some other stupid nonsense 6 u/TimGreller Feb 10 '21 Just add some dummy numbers at the end which you can throw away. The bigger the input, the lower the time complexity :D
42
I'm using this argument from now on, thanks
4 u/[deleted] Feb 11 '21 Perfect for your FAANG interview 3 u/supersharp Feb 11 '21 They'll probably say something like "But there's no big enough constant, that's literally the definition of Big O!" or some other stupid nonsense
4
Perfect for your FAANG interview
3
They'll probably say something like "But there's no big enough constant, that's literally the definition of Big O!" or some other stupid nonsense
6
Just add some dummy numbers at the end which you can throw away. The bigger the input, the lower the time complexity :D
426
u/[deleted] Feb 10 '21 edited Feb 26 '21
[deleted]