Coding contests >> snippet contest
Posted by IbYdI on 20:50:00 02-12-2002
The "looping question" in C++ section inspired me to make this contest.

The Goal:
Make a sorting algo. that will sort an array of 10.000 short ints.
The Winner is the One who programms the fastest algo.

And another thing :
Write it yourself, dont cheat.
This is not about winning, but comparing ideas.
But maybe the winner should receive some extra points for the Hall Of Fame. Right ops? [addsig]
Posted by Govtcheez on 21:03:00 02-12-2002
Are we being languageist (it's a word now)?

I've got something in Java at home...
Posted by IbYdI on 21:16:00 02-12-2002
Ok i forgot to post some things:
1. dont flame
2. no java
3. vb,c,++, pascal even but NO java
4. dont ask stupid questions (like the ones in the channel)
5. participate if you wont, or dont
and if you dont, why are you on this forum (btw, this is a rhetorical question)
Posted by Govtcheez on 21:18:00 02-12-2002
What's the problem w/ Java? I mean, crap, you're allowing Pascal and VB, or all things...
Posted by IbYdI on 21:20:00 02-12-2002
To be honest : It's Personal.
*put otherway i hate java since it made a mess mess mess on the market + its slow
Posted by Govtcheez on 21:22:00 02-12-2002
Um.... ok... I'm gonna post it anyways - that's a lame reason... Besides, if we know they're gonna be ints, all someone needs to do is put up a linear sort of some kind... How do you beat that?
Posted by IbYdI on 21:57:00 02-12-2002
its about writting your own sort algo, not putting an already written one.
and you know its gona be short int, sorted from 1-2, or 2-1 manner, theres gonna be lot of them so some optimisation sure is needed.
and the whole thing is about seeing interesting ideas...
Posted by dxprog on 22:45:00 02-12-2002
Is that 10 thousand or 10 decimal 000? And VB is accepted? [addsig]
Posted by MoX on 23:22:00 02-12-2002
It's actually about sorting ten comma zero zero zero short ints
Posted by fsvara on 23:35:00 02-12-2002
the problems is see:

-it's hard to invent a _new_ search algo... i have something in mind (i "invented" it quite long ago) but i'm pretty sure somebody has done it somewhere before...
-it's hard to compare between langauges... if somebody's gonna sue asm, thats gonna be faster by definition...
Posted by IbYdI on 06:34:00 02-13-2002
its ten thousands or more.
svara : i agree. im gonna write the algo that always sorts half of the array and then splits the array... mmmm youll see.
but to write a sorting algo wont take long
try it
Posted by fsvara on 12:45:00 02-13-2002
ok, i'm gonna try it once my current little project is finished...
Posted by KaGez on 13:50:00 02-13-2002
heh... you wanna make a contest for the fastest program and allow asm, C (no C++), VB and Pascal... VB is _extremely_ slow, so is Pascal. So you've got the choice between C and asm.... now, most can't program in asm, so they'll use C. Then, guys like robert come along and code some asm stuff and it's faster, much faster. You can't compare asm with VB or such things. It's just like comparing the size of a Fly with the size of a Elephant...
And, btw: Contests are Contest, and have nothing to do with the HoF, or does it?
Anyways, I think this contest _can't_ end in a result, since all languages are not the same speed. How will you measure the speed? If I for example develop a little proggy on my Athlon 1GHz, that does the stuff in 0.001 seconds, and if it's wrong coded it does it in 0.002 seconds, how the hell should I see the difference? To be honest, I think it's stupid to make a contest about speed in programs without professional measuring devices ....
[addsig]
Posted by robost86 on 17:54:00 02-13-2002
KaGez: Why do you say Pascal is extremly slow? It's not...

There are programs to measure the speed. One problem might be the OS, I'm afraid for example in Linux the program won't run as fast as in for example DOS with interrupts disabled. Everyone don't have the same OS either.

[ This Message was edited by: robost86 on 2002-02-13 17:57 ]
Posted by IbYdI on 19:50:00 02-13-2002

first of all this is vb,c,c++,asm,pascal contest because i want to gather people in it. cause if i said this is a vb contest i would get questions like "why not c++", if i said vb,c++ someone would ask "can i code in pascal", or "can i code in assembler".
and its a simple contest since its the only way to make people participate in it.
then : there are speed gradients that are ough to be used. *dont ask me what it is, find it yourself if you wanna
Another thing: ill (you can also if you will) test them on my slower pc(pII 450). It takes only few lines of code to implement a timer that counts in miliseconds. All algos are to use the same array,same machine, same os when tested.
So please dont worry about it.
Only thing you can do is to take part in it.
now i repeat:
if you dont want to be in it, dont sabotage it . Hope i made myself clear.

PS.Actually it has to do something with the hall of fame : the one that wins ----> is to get his algo submited, then rated *and ill rate the winner with a ten* ----> ...
PS2.Ill submit my algo tomorow, or tonight, as soon as i get the time to finish it.

so i repeat again :
dont worry about anything.
just code if you want, and if you dont
: do whatever you like but dont interupt this contest nor forum.

I wish you luck.
Posted by IbYdI on 11:35:00 02-16-2002
Public Sub sorteMe(sortMe() As Integer)

Dim intL, intU, intTmp, X, Y As Integer
intL = LBound(sortMe)
intU = UBound(sortMe)

Y = (intU - intL + 1) \ 2

Do While Y --> 0
For X = intL To intU - Y
If sortMe(X) --> sortMe(X + Y) Then
intTmp = sortMe(X)
sortMe(X) = sortMe(X + Y)
sortMe(X + Y) = intTmp
End If
Next X
For X = intU - Y To intL Step -1
If sortMe(X) --> sortMe(X + Y) Then
intTmp = sortMe(X)
sortMe(X) = sortMe(X + Y)
sortMe(X + Y) = intTmp
End If
Next X
Y = Y \ 2
Loop

End Sub
[addsig]
Posted by IbYdI on 11:38:00 02-16-2002
it has 0.25 average time for sortiong a random array of 10000 short ints. [addsig]
Posted by IbYdI on 14:47:00 02-17-2002
/me cant believe that noone wrote nekcuf sorting alog.
hmmm [addsig]
Posted by fsvara on 16:36:00 02-17-2002
as i said, i ahve other coding stuff to do atm, and i want to finally finish my current proejct
Posted by IbYdI on 16:40:00 02-17-2002
/me understands, but this was supposed to be easy. [addsig]
Posted by KaGez on 12:35:00 02-18-2002
/me is coding on a GTK+ image viewer atm and tries to imporve his coding skills
That's it
[addsig]