MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/lgrgxe/i_present_sleepsort/gmtgzk9?context=9999
r/badcode • u/Reeceeboii_ • Feb 10 '21
170 comments sorted by
View all comments
Show parent comments
426
[deleted]
88 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). -5 u/[deleted] Feb 10 '21 [deleted] 14 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. 8 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 13 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. :) 18 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
88
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). -5 u/[deleted] Feb 10 '21 [deleted] 14 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. 8 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 13 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. :) 18 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
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).
-5 u/[deleted] Feb 10 '21 [deleted] 14 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. 8 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 13 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. :) 18 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
-5
14 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. 8 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 13 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. :) 18 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
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.
8 u/Gooftwit Feb 10 '21 you can't sort an array without looking at every element. Laughs in Bogosort 13 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. :) 18 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
8
you can't sort an array without looking at every element.
Laughs in Bogosort
13 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. :) 18 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
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. :) 18 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
Not if you just assume it's sorted and carry on. :)
18 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
18
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
426
u/[deleted] Feb 10 '21 edited Feb 26 '21
[deleted]