Today's Question:  What are you most afraid of as a programmer?        GIVE A SHOUT

Technical Article => Programming =>  Programming

Some thoughts about competitive programming

  sonic0002      2014-03-02 07:26:21      5,361    0    1

Many programmers may have experience in participating different kinds of coding competition while they are in college. Many of them are hired by top IT companies for their excellent performance during these kinds of coding competitions. There are some famous competitions organized by IT companies such as Google Code Jam, Facebook hackathons etc.

Coding competitions are places where programmers can show their talents in programming and the skills they have. Usually programmers will solve some toughest problems in programming or in real life, lots of them are algorithm and math related. It has its advantages: fun, learning experience, bragging rights  Also if the participants perform well, they will get public recognition as well and will potentially get noticed by IT companies. However, apart from the pros, there are also some criticisms about coding competitions.

Competitive programming on platforms such as Topcoder, Codeforces, ICPC, Codechef, etc. have a lot of deficiencies due to the format. The questions are forced to be such that your solution takes a particular kind of input, runs for a few seconds and gives the output. Here are some  problems associated with this format:

  1. It is almost impossible to have questions on approximate/randomized/parallel algorithms, etc. There are a lot of interesting problems in these fields.
  2. There are practical aspects of programming which are ignored due to the limit on runtime, e.g. caching, external memory accesses, etc.
  3. There are some algorithms which can't be asked because the time complexities don't suit the runtime limit. e.g. an O(2^N) algorithm may beat an O(N^6) algorithm for any input which can run in 5 seconds.
  4. It's difficult to ask questions which are interactive, e.g. a game where you have to make a move depending on some move by the judge. The field of online algorithms is also relevant here.
  5. Some algorithms which are difficult to code are ignored even though they give rise to interesting problems, e.g. suffix tree construction, voronoi diagrams, RMQ, persistent data structures, etc.

Due to above reasons, people end up solving problems from a very small subset of interesting problems again and again. After a certain level of practice, a lot of problems are all about relating the question with some previously seen question. Not all of them are like this, but a lot of them are.

Apart from these, the emphasis on speed encourages a lot of bad programming habits, e.g. poor variable names, badly written macros, declaring everything global, using 'gets' or even 'read' to get input fast, etc. People who are trying competitive programming for the first time actually think that they are good practices!

Conclusion: It's interesting to take part in these contests for some time. But after a certain point, it's not going to help you much. You would have more fun and learn more by getting involved in other things.



Share on Facebook  Share on Twitter  Share on Google+  Share on Weibo  Share on Reddit  Share on Digg  Share on Tumblr    Delicious



No comment for this article.


When refactoring other's code

By sonic0002