Featured

10 Things to Know About Speed Programming Competitions

If you’re a budding computer science student in the early stages of getting a college degree, you might have come across, or at least heard, about speed programming competitions.

Almost every university with a computer science program holds its own technology olympiad in Pakistan; NUST arranges its own NUST Olympiad, FAST has Procom, IBA boasts ProBattle, Karachi University’s UBIT conducts ProQuest and more.

One thing that is common in all these events is that none of them is complete without a battle of the coders— the prize jewel of tech-related competitions, “Speed Programming”.

What is Speed Programming?

Speed Programming, also known as competitive programming, is a competition for IT-disciplined students to show off their programming skills by solving logical puzzles using code. Aptly named, speed programming is a timed competition in which the faster and the more programs you solve, the better your chances are of winning it.

Generally, a Speed Programming competition consists of two rounds; Qualification and a Final. In each round, you get from five to six problems and the ones who solve the most problems move on to the next round.

However, solving all of the problems is almost never possible and most competitors barely manage to solve a couple, or at most, three or four problems. For some tough competitions, even if you manage to solve just one problem, you have a chance of moving on to the next round.

A programmer myself, I have participated in more than a couple of programming competitions since I started college. As a starter, I didn’t find enough decent online resources to help me prepare for me for a Speed Programming competition and only after abysmally failing to solve even a single problem in my first competition did I learn how it all worked.

So, for beginners like myself, here is a helpful guide for taking part in a speed programming competition,

  • Learn File I/O:

File I/O stands for File Input/Output. One of the most basic requirements of taking part in a speed programming competition in almost any university in Pakistan is the ability to take input from a file. Without it, there is no way you can solve even a single problem as every question requires you to take input for your program from a text file.

The methods of reading or writing from/to a file differ from language to language and a single programming language can also have multiple ways to achieve that. For example, if you are programming in Java, Buffered Reader and Scanner are generally used to read input from a file. Generally, the output is given on the console so learning to write on a file isn’t as important as reading from it.

  • Be familiar with your coding environment

PCs provided to you at the time of the competition usually come pre-installed with most popular IDEs, text-editors, and programming softwares. You can also request for a particular software of your choice in some cases. You should go with the coding environment you are most familiar or used to.

  • Forming a good team

Speed programming competitions are mostly team-based, allowing up to 3 people to compete as a team. Form your team carefully. There are a lot of ways to form a good team, depending on your personal preference.

One way is to have one person who is good at logic puzzles and designing algorithms for them, one who is good at typing fast, and one who has good knowledge of programming libraries and built-in functions.

  • Knowledge of Data Structures

At least one person in your team needs to have a good knowledge of data structures, including arrays, linked lists, trees, graphs, etc.

  • Go for brute force, not optimization

The datasets given in programming competitions are not that large and don’t require much computing power. Therefore, there is no point of wasting your time by going for optimization. Time is the thing you lack the most, not computing power. Just go for the most straightforward way of solving a problem you can think of!

  • Ditch Exception Handling

There is no point in adding exception handling to your code. An exception means there is a problem in your code, and if there is a problem in your code, you won’t get any marks for solving it, regardless of the fact if it has exception handling or not. There are no half marks for “nearly” solving it. So adding exception handling is just a waste of precious time.

  • Learn how to submit

Most competitions use PC^2, a programming contest control tool, for checking codes submitted by the competitors. Usually, you have to submit just the source code files (.c, .cpp, .java, etc). However, the procedure of submission may differ from competition to competition. Learn about it beforehand so as not to waste time when you have to submit a code.

  • Tackle the easiest problem first

Go through all the problems first and try to figure out which one is the easiest. Once you have done that, do that one first! If you get stuck, just move on to the next-easiest problem. Solving all the problems is almost unattainable so there is no point in getting stuck over just one.

  • Test your program before submission

Test your program thoroughly before submission by adding or changing the input values to check if it works as a generalized code. Also, try to figure out some unique input values that could break your code and test them out. Your code needs to be completely generalized and should work with any input given within the described constraints.

  • Practice!

There is no better way to get ready for a competition than to practice. You can find lots of resources online with just a simple google search. You can also try out past problems given at Google’s Code Jam competition, a kind of a speed programming for the whole world. They may be a little harder than your average competition but they are the best practice you can get.

Share
Published by
Rehan Ahmed