I answered all the questions using python and was surprised to see the majority of the top coders (you know, the guys who solved everything in ~30 minutes) use C++ and Java. I had the impression that the difference in python's runtime would be made up for how much more succinctly you can code in it and by all the syntactic sugar... but I guess not. In fact, I noticed some of the top guys have various built in libraries to help them reduce their time spent on input handling and various solver interfaces. The auto generated code from those libraries dwarves the actual solution code in size.
Maybe that's because the verboseness of C++ or Java isn't really that much of a problem, since the experienced coders can usually type quickly, and moreover, most of the programming work is thinking, not typing.
Also, the experienced coders also already have template macros for frequently used code snippets, like loop, conditional statements, comparisions, sorting etc., making doing trivial things in C++/Java, as trivial as doing them in Python (or other high level language).
The verboseness, because of the need to type more code is never a major problem.
Verboseness is indicative of the abstractions that are exposed, and that being at a lower level than necessary is the problem because you don't just have to deal with the problem at hand, but also the holes in languages.
With years of practice in a similar area, many people would have their own libraries to abstract those language shortcomings.
In general, the verbosity because of the bad abstraction levels is always a problem, because different people using it will have their own versions to patch them up.
C(++)/Java are really popular in most coding competitions, but I don't know if that necessarily says anything. Recently a very decent competition (anyone remember?) was won by someone coding in Pascal.
Somewhat educated guess, but it probably has to do with the fact that those contests offer well defined, immutable specifications. No need to iterate a lot or refactor much.
Curious what you are trying to say. I program mostly in Python, but never considered ease of refactoring to be its strength. I felt more comfortable changing code in C++ mostly because of the static typing providing additional correctness guarantees at run-time.
I just looked at the top scoring solution, written in C++, and a Java solution next to mine in the scoreboard, and I can only say that I am really happy with my choice of Ruby.
As for the top scorer, I can't help but wonder if that skill even translates well to the real world?
I was curious as to what proportion of each language achieved a perfect score. A quick script [1] sorted by Percent which reached perfect score and then by qualified resulted in the below - mean of advanced/lang is: ~90%, most (26) langs either achieved 100% entry or around 80% (14) ).
I tried to use Haskell, and I think that choice bit me (not Haskell's fault, I hasten to add). I saw the correct solutions right away, but I was nowhere near good enough at recognizing the causes of type errors and I/O in general to produce them in the amount of time I had (I started late). C'est la vie. Learning experience.
I think its important to note that many coding competitions historically only allow C/C++/Java. There is advantage in that you can use many hacks in these languages to get around certain issues quickly if your an innovative person (which you have to be to do the contest questions).
C++ and java seems to be two languages allowed in all algorithmic competitions and people are used to it. I think reasons for which C++ is the dominant one are a bit historical - for example when I started participating in those contests, all my friends used C++ and recommended me to learn it too (though now I think I'd stick with java; and in gcj I used common lisp).
When I started, I was thinking about using JS both "for the lulz" and because I'm comfortable enough with it that it wouldn't be a hindrance, like LOLCODE or Befunge.
I went with python instead because I assumed I'd need to squeeze as much efficiency as possible out of my programs.
For this round, these fears were completely unwarranted. All of the problems, except the second, were trivially O(n). (#2 wasn't worth optimizing, but it was possible)
Does anyone have experience with the next round? Is speed still not really an issue?
So did Google choose C++/Java/Python as their standard languages or are they just the natural standard languages of the industry? Was there any push by Google to those 3 languages aside from developers knowing that is what they use internally?
Google doesn't care what language you use, or in fact even if you compute it manually. All they need is a output file that confirms with their output. - You can provide, whatever the sources.
These are of course, the standard industry choices these days. Except there is a huge bias for C++, as for most competitors, that is a standard language.
34 comments
[ 0.29 ms ] story [ 70.3 ms ] threadI answered all the questions using python and was surprised to see the majority of the top coders (you know, the guys who solved everything in ~30 minutes) use C++ and Java. I had the impression that the difference in python's runtime would be made up for how much more succinctly you can code in it and by all the syntactic sugar... but I guess not. In fact, I noticed some of the top guys have various built in libraries to help them reduce their time spent on input handling and various solver interfaces. The auto generated code from those libraries dwarves the actual solution code in size.
They'd have solved these kinds of questions for years, and have ready templates for parsing the input and output.
Verboseness is indicative of the abstractions that are exposed, and that being at a lower level than necessary is the problem because you don't just have to deal with the problem at hand, but also the holes in languages.
With years of practice in a similar area, many people would have their own libraries to abstract those language shortcomings.
In general, the verbosity because of the bad abstraction levels is always a problem, because different people using it will have their own versions to patch them up.
As for the top scorer, I can't help but wonder if that skill even translates well to the real world?
Used Haskell, PostScript, Python, Prolog, Perl, J, Brainfuck, C, each once for one problem.
I went with python instead because I assumed I'd need to squeeze as much efficiency as possible out of my programs.
For this round, these fears were completely unwarranted. All of the problems, except the second, were trivially O(n). (#2 wasn't worth optimizing, but it was possible)
Does anyone have experience with the next round? Is speed still not really an issue?
These are of course, the standard industry choices these days. Except there is a huge bias for C++, as for most competitors, that is a standard language.