Ok - The results are in - 19 Submissions
A few people who developed solutions in this thread didn't submit
e.g Nickk and Rjindael - maybe you could upload your code anyway somewhere when it's done.
So every submission was correct in that it matched the spec perfectly and performed correctly to given inputs. This made picking a winner very tricky...
I don't have access to my 980x at the moment as im away for xmas, but all code was executed on a quad core Q8400 with 2gb ram. Everything except C# code was evaluated on Linux 64bit and C# code under Windows 7 64bit. Even then I did some comparisons between running c# under linux/mono and windows and there was very little in it. All timings were averaged over 3 executions.
Language Summary:
Java - 1
PHP - 1
Python - 2
C - 5
C++ - 3
C# - 7
So as expected C/C++ were the fastest performers with Python and PHP being surprisingly slow, even with good code being used. Several people used threading, be it pthreads, boost or .NET, all were fine.
Here are individual stats and links to everyone's code:
Bloomfield - C++
View Code
Time:
2.172 seconds
Lines of Code: 303
Crowze - PHP
View Code
Time:
9.291 seconds
Lines of Code: 843
Lightnix - C
View Code
Time:
0.227 seconds
Lines of Code: 354
Matja - C
View Code
Time:
0.147 seconds
Lines of Code: 225
Grimbough - C
View Code
Time:
0.099 seconds
Lines of Code: 329
MrMark - C#
View Code
Time:
0.281 seconds
Lines of Code: 273
Nimble - C++ **
Winner **
View Code
Time:
0.049 seconds
Lines of Code: 977
oOYoDaOo - C#
View Code
Time:
0.438 seconds
Lines of Code: 504
PaulStat - Python
View Code
Time:
8.160 seconds
Lines of Code: 184
Peve - Java
View Code
Time:
1.074 seconds
Lines of Code: 338
Pho - C#
View Code
Time:
0.225 seconds
Lines of Code: 736
Phyre - C#
View Code
Time:
0.173 seconds
Lines of Code: 607
Rat Hat - C ** Second **
View Code
Time:
0.110 seconds
Lines of Code: 246
7e7en - Python
View Code
Time:
9.445 seconds
Lines of Code: 181
Seany84 - C#
View Code
Time:
2.1 Seconds
Lines of Code: 306
Swanser - C
View Code
Time:
0.174 seconds
Lines of Code: 416
Thrash - C#
View Code
Time:
1.2 seconds
Lines of Code: 491
Tillus - C++
View Code
Time:
0.800 seconds
Lines of Code: 523
Haircut (Jon) - C# (many files!)
View Code 1
View Code 2
View Code 3
View Code 4
View Code 5
View Code 6
View Code 7
View Code 8
Time:
0.625 seconds
Lines of Code: 537
Winner: Nimble - Very nice overall implementation with threading used very effectively. Although the code is slightly lengthy and verbose and some elements could have been trimmed down, it all works nicely and is easy to read and comprehend
- Rat Hat & Grimborough very nearly had the edge here as their code was a bit more 'raw/lower level', but I could only pick one.
Runner Ups: Rat Hat, Grimborough, Lightnix, Phyre, Pho - honestly everyone's was very good with good algorithms and efficient implementations. It's very difficult to say one is better than the other!
Hope everyone enjoyed the competition and learnt some bits and bobs along the way
(Now you can tear each others code apart
)
Nimble - I'll drop you a mail so you can claim the epic prize fund