Thursday, January 14, 2010

How to Prepare for a Programming Competition

Programming can be difficult enough when there is a long time frame to complete projects, let alone when you have to cook up a solution in less than an hour during a programming competition. Do you have what it takes to compete with the rest of the competitive programming world? The only way to find out is to take some preparatory steps, and have your hand at one of many different online coding sites. If you can cut it - there is serious money to be made! This article will focus on algorithm development.

Instructions

Things You'll Need:

  • Your choice of language and compiler
  • Internet Connection
  1. Step 1

    If your new to programming contests, you will find there are a wide variety of types of contests available today - ranging from conceptualization and design, to requirements writing, to algorithms. From my own professional experience, if you can train yourself to develop algorithms quickly, you can succeed in almost any aspect of the software development cycle.

    Step 1 - Pick your language.

    Most competitions will allow you to choose between a few object oriented languages - usually C++, C# and Java. Syntactically, these languages are very similar, and pretty much anyone competent in one can adjust to the other if required.

  2. Step 2

    Most programming competition sites have their own online editor, or applet from which to develop, communicate, or submit code. I find that in most cases, this editor isn't suitable for doing the coding and debugging required. Therefore, make sure you have your standard development environment handy and setup to do your coding and debugging. If you do not have a suitable development environment at home, you can download Eclipse (for Java) for free, or either of the Microsoft C++/C# Express editions for free. All are suitable for algorithm competition.

  3. Step 3

    Once your configured, review the rules of the competition site, and make sure you have any additional recommended plug-in's or software required for the competition.

  4. Step 4

    Now comes the fun part - what do I need to brush up on in order to compete? In algorithm competitions, you will find heavy use of the following:

    String manipulation and parsing
    Regular expressions
    Graph and geometrical theory
    Combinatorics and probability
    Numerical set manipulation
    Sorting
    Number theory problems
    Other mathematical constructs

    These will be described in detail in the next few steps.

  5. Step 5

    It's pretty obvious you will need to brush up on discrete math - and implementing such concepts in code. Along the way it's helpful to build helper functions that can be re-used in competitions. Having a good library of such functions will give you a leg up when time is short. Not to worry, there are tons of examples out on the internet - but you should develop your own!

    Other types of mathematical problem crop up as well, many involving prime numbers, etc... Make sure you have an efficient algorithm for identifying prime numbers before you start.

  6. Step 6

    Next, make sure you know the basic quick sorting algorithms and code some samples. Not only must your code generate the required output, it must also do so in a reasonable amount of time.

  7. Step 7

    Finally, it's imperative that you can quickly access and utilize all of the string manipulation functions available to you within your language library. String manipulation and parsing are used everywhere, and can even be applied to numerical sets. As an extension of this, it's very helpful to have a reference next to you for basic regular expressions. Sometimes, these are easier to use than manual parsing, sometimes not!

  8. Step 8

    The next step is to practice, practice, practice!! There are two places you can practice:

    The competition site itself. Most programming competition sites have a list of past problems and solutions, and some method of submitting your problem for grade. I would advice practicing here as it gives you a feel for the type of problems you may actually encounter. However, some sites take some time in grading, meaning you may have to wait for your answer.

    The second option is to use a site like Project Euler. Project Euler is a site that consists of around 260 math style problems that are intended to be solved through programming. The neat thing about Project Euler is that there is one single answer to each of the problems, so you know right away if you got it right. Your progress is also tracked against others. I personally prefer Project Euler as a starting point for your practice because it will force you into math concepts immediately from the first problem - and the problems only increase in difficulty as time goes on.

  9. Step 9

    The above should be enough to get you started, but the only way to really find out if you are ready is to sign up and take part in a contest!

No comments:

Post a Comment