sort rant
1
Name:
Anonymous
2008-04-08 20:55
Seriously... why can't we just do things ONE WAY? All these different types of sorts, for no reason at all except to get a faster running time with programs made for computers that won't even NOTICE the difference between a selection or merge sort. So what if heap sort has a constant O(n log n) time? I don't care! So stop assigning me stupid CS labs telling me to figure out different sorts.
All this from a high school APCS student...
2
Name:
Anonymous
2008-04-08 21:10
>high school
3
Name:
Anonymous
2008-04-08 21:57
Something tells me that
>>1-2 are the same person and WHBT constantly
4
Name:
Anonymous
2008-04-08 22:00
Neone here got a slab allocator that i could borrow plz ?thx
5
Name:
Anonymous
2008-04-08 22:08
>>3
Guess what? They're not...
6
Name:
Anonymous
2008-04-08 22:10
>>1-6
Only one person on
/prog/ .
7
Name:
Anonymous
2008-04-08 22:37
I understand IHBT, but I still want to respond.
You see, [spoiler] [b] FORCED INDENTATION OF THE CODE.[/spoiler]
THREAD OVER.
8
Name:
Anonymous
2008-04-08 22:48
>>7
ARRRRGGGGHHHH
[b] [u] RAGE/u]
[/b]
FORCED IND ENTATIO n OF THE CODE
THREAD OVER.
9
Name:
Anonymous
2008-04-09 2:19
10
Name:
Anonymous
2008-04-10 11:14
>>1
Only radixsort and quicksort (and heapsort as an alternative to quicksort) are relevant. All the other sorting algorithms are only taught for the sake of having students understand how to analyze algorythms. You're not being taught "sorting algorithms," you're being taught how to analyze worst-cases, understand Big O notation, etc. You'll never fucking use bubble sort anywhere, moron, but knowing this sort of shit is what tells an
ENTERPRISE JAVA PROGRAMMER apart from an
EXPERT PROGRAMMER .
IHBT, right?
11
Name:
Anonymous
2008-04-10 16:59
12
Name:
Anonymous
2008-04-10 17:22
>>10
how to analyze algorythms.
RYTHM?!
EURYTHMICS!?!?!
SWEET DREAMS ARE MADE OF THIS
13
Name:
Anonymous
2008-04-10 17:27
>>12
back to /b/, please.
14
Name:
Anonymous
2008-04-10 17:35
>>12
who am I to disagree?
15
Name:
Anonymous
2008-04-10 17:37
>>12
Lastest Firefox nightly broke my spellchecker. Missed that one.
16
Name:
Anonymous
2008-04-10 17:45
Lastest Firefox nightly broke my spellchecker. Missed that one.
Lastest Firefox nightly
Lastest
17
Name:
Anonymous
2008-04-10 17:49
>>15
This is why spellcheckers and syntax highlighting makes people stupid.
18
Name:
Anonymous
2008-04-10 17:53
19
Name:
Anonymous
2008-04-10 17:56
20
Name:
Anonymous
2008-04-10 17:56
21
Name:
Anonymous
2008-04-10 17:56
>>20
It's a kinda greeed.
22
Name:
Anonymous
2008-04-10 17:57
>>20
It's a kinda greed. Greed. Greed.
[b] GREEEEEED!!!![/b]
23
Name:
Anonymous
2008-04-10 18:04
>>22
Suddenly I have the urge to play the Addams Family pinball game...
24
Name:
Anonymous
2008-04-10 18:07
>>23
One word: Wednesday from the Addams Family movie.
^ _^
25
Name:
Anonymous
2008-04-10 18:13
>>22
Did the
lastest Firefox nightly break your
BBCode checker too?
26
Name:
Anonymous
2008-04-10 18:14
>>25
Would you be so kind to /r/ your checker, thanks.
27
Name:
Anonymous
2008-04-10 18:27
>>26
I will not request my checker, no. I already have it!
28
Name:
Anonymous
2008-04-10 19:24
>>27
I want a checker plz halp me :]
29
Name:
Anonymous
2008-04-10 19:27
30
Name:
Anonymous
2008-04-12 1:18
Bubblesort is actually faster than quicksort in datasets which you know are "almost sorted".
So never say never.
... to be honest I've never actually run into this situation.
31
Name:
Anonymous
2008-04-12 1:40
>>20,21
kinda
kinda
kinda
kinda
KINDA
32
Name:
Anonymous
2008-04-12 3:52
>>1
Runtime isn't the only thing that matters ... when you enter college CS, you'll learn all about the wonderful world of space analysis, cache locality, and memory-efficient algorithms. Hopefully.
33
Name:
Anonymous
2008-04-12 4:32
why don't you want your programs to run faster?
34
Name:
Anonymous
2008-04-12 5:59
void sort(uintmax_t *numbers, size_t length){
uintmax_t temp[length], *arrays[2] = {numbers, temp};
for(uint_fast8_t i = 0; i < sizeof(uintmax_t) * CHAR_BIT; ++i){
for(size_t j = 0, start = 0, end = length - 1; j < length; ++j){
if(!(arrays[i & 1][j] & 1 << i))
arrays[i & 1 ^ 1][start++] = arrays[i & 1][j];
if(arrays[i & 1][length - j - 1] & 1 << i)
arrays[i & 1 ^ 1][end--] = arrays[i & 1][length - j - 1];
}}}
O(n) time, O(n) space, and the whole thing is only 8 lines of code.
35
Name:
Anonymous
2008-04-12 6:19
36
Name:
Anonymous
2008-04-12 6:24
>>35
it's better than
))))))))))))))))))))))))))))))))...
37
Name:
Anonymous
2008-04-12 7:17
>>34
what am i looking at here?
38
Name:
Anonymous
2008-04-12 8:20
39
Name:
Anonymous
2008-04-12 8:20
>>34
}}}
That's some punchline right there.
40
Name:
Anonymous
2008-04-12 8:20
>>34,35
By the way, those {} for the for statements are not needed.
Newer Posts