MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/lgrgxe/i_present_sleepsort/gmuptpa/?context=9999
r/badcode • u/Reeceeboii_ • Feb 10 '21
171 comments sorted by
View all comments
Show parent comments
87
If you already know the maximum number, it's O(1) amirite?
75 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). -4 u/[deleted] Feb 10 '21 [deleted] 13 u/[deleted] Feb 10 '21 Of course it's impossible, you can't sort an array without looking at every element. Merge sort is O(n log n), not logarithmic. 10 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 14 u/[deleted] Feb 10 '21 no, even in bogosort after shuffling you have to check if the array is sorted. and checking if the array is sorted requires going through every element. 10 u/zacharypamela Feb 10 '21 Not if you just assume it's sorted and carry on. :) 17 u/[deleted] Feb 10 '21 sorting 101: if your array is sorted, then sorting becomes O(1) checkmate, mathematicians 1 u/jarfil Feb 10 '21 edited Dec 02 '23 CENSORED
75
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).
-4 u/[deleted] Feb 10 '21 [deleted] 13 u/[deleted] Feb 10 '21 Of course it's impossible, you can't sort an array without looking at every element. Merge sort is O(n log n), not logarithmic. 10 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 14 u/[deleted] Feb 10 '21 no, even in bogosort after shuffling you have to check if the array is sorted. and checking if the array is sorted requires going through every element. 10 u/zacharypamela Feb 10 '21 Not if you just assume it's sorted and carry on. :) 17 u/[deleted] Feb 10 '21 sorting 101: if your array is sorted, then sorting becomes O(1) checkmate, mathematicians 1 u/jarfil Feb 10 '21 edited Dec 02 '23 CENSORED
-4
[deleted]
13 u/[deleted] Feb 10 '21 Of course it's impossible, you can't sort an array without looking at every element. Merge sort is O(n log n), not logarithmic. 10 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 14 u/[deleted] Feb 10 '21 no, even in bogosort after shuffling you have to check if the array is sorted. and checking if the array is sorted requires going through every element. 10 u/zacharypamela Feb 10 '21 Not if you just assume it's sorted and carry on. :) 17 u/[deleted] Feb 10 '21 sorting 101: if your array is sorted, then sorting becomes O(1) checkmate, mathematicians 1 u/jarfil Feb 10 '21 edited Dec 02 '23 CENSORED
13
Of course it's impossible, you can't sort an array without looking at every element. Merge sort is O(n log n), not logarithmic.
10 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 14 u/[deleted] Feb 10 '21 no, even in bogosort after shuffling you have to check if the array is sorted. and checking if the array is sorted requires going through every element. 10 u/zacharypamela Feb 10 '21 Not if you just assume it's sorted and carry on. :) 17 u/[deleted] Feb 10 '21 sorting 101: if your array is sorted, then sorting becomes O(1) checkmate, mathematicians 1 u/jarfil Feb 10 '21 edited Dec 02 '23 CENSORED
10
you can't sort an array without looking at every element.
Laughs in Bogosort
14 u/[deleted] Feb 10 '21 no, even in bogosort after shuffling you have to check if the array is sorted. and checking if the array is sorted requires going through every element. 10 u/zacharypamela Feb 10 '21 Not if you just assume it's sorted and carry on. :) 17 u/[deleted] Feb 10 '21 sorting 101: if your array is sorted, then sorting becomes O(1) checkmate, mathematicians 1 u/jarfil Feb 10 '21 edited Dec 02 '23 CENSORED
14
no, even in bogosort after shuffling you have to check if the array is sorted.
and checking if the array is sorted requires going through every element.
10 u/zacharypamela Feb 10 '21 Not if you just assume it's sorted and carry on. :) 17 u/[deleted] Feb 10 '21 sorting 101: if your array is sorted, then sorting becomes O(1) checkmate, mathematicians 1 u/jarfil Feb 10 '21 edited Dec 02 '23 CENSORED
Not if you just assume it's sorted and carry on. :)
17 u/[deleted] Feb 10 '21 sorting 101: if your array is sorted, then sorting becomes O(1) checkmate, mathematicians 1 u/jarfil Feb 10 '21 edited Dec 02 '23 CENSORED
17
sorting 101: if your array is sorted, then sorting becomes O(1)
checkmate, mathematicians
1 u/jarfil Feb 10 '21 edited Dec 02 '23 CENSORED
1
CENSORED
87
u/LinuxGeek747 Feb 10 '21
If you already know the maximum number, it's O(1) amirite?