I decided that how to prepare students for programming competitions would be a very interesting topic. It’s definitely a rarer situation, but I have taught a few students who were primarily focused on programming competitions. I will also be discussing some resources for teaching competitive programming classes.

If you don’t know what competitive programming is, well it is a type of competition. Students are given a set amount of time (it varies depending on the competition) to solve a set number of problems. A program then decides if the solution is valid. Validity is checked based on what output is expected given the test data. These competitions are very popular right now, and very prestigious. I participated in them while I was in college, and they were always a lot of fun. The most famous competition is the A.C.M Programming Competition

Introduction

As I mentioned above, the most popular programming is the ACM programming competition. Programming competitions aren’t only for college students though, high school programming competitions are extremely popular as well. Here are a few that are happening in 2020

https://www.cs.cornell.edu/events/cornell-high-school-programming-contest https://www.monmouth.edu/programming-contest/ https://contest.acm.bw.edu/

Those are just a few to give you an idea of how they work. I would recommend taking a look at them to find out the details about things like team sizes, registration dates, or other more administrative things you may need to know. For this article, I will just be focusing on how to teach a competitive programming class.

Competitive Programming Teaching Strategies

Most of these programming competitions offer only the following languages: C, C++, and Java. While the language you pick doesn’t technically make a difference. As in, all questions can be answered in all languages, it can make a big impact on how well your students do. There are a few reasons for this. Firstly, most high schools are learning Java, at least in America, as the A.P. test is given in Java. Some high schools in Asia do teach C and C++ over Java, but I tend to lean towards using Java. Most importantly though, I recommend sticking to one language. If you try to teach each problem in multiple languages, you will most likely not have enough time to cover all the questions you need to.

When I did programming competitions, we used C++ because all of our computer science classes used it as well. Many universities have switched to Java, or Python, but mine still primarily teaches using C++. One reason I don’t recommend C++ is that even if you are using the STL library, Java still has a lot of features that are much more useful. There any many problems which involve large integers, which can actually be solved quite easily using Java’s BigInteger. Knowing tricks like this can make it very easy for your students to solve 1 or 2 easy problems quite quickly.

When teaching these languages make sure to spend a lot of time going over the STL (for C++) and the most common built in libraries for Java. Especially focus on how to read and write to files. This is extremely important for the competitions, and it should not be something students have to think about.

Also, when going over practice problems, try to always explain your thinking process out loud. One thing I have noticed is that I can usually solve a problem because I have seen past problems like that. If you explain this way of thinking to your students, you will find that they are able to more quickly recognize problems which are very similar.

Resources to use for teaching competitive programming

There are a lot of resources for practicing competitive programming, and many of these resources are useful for teaching it as well. Today I will be talking about a lot of problem sets, and where to find them. I will also be talking about some online competitions that could be used for practice. In addition to that, there are programs you can use to emulate the competitive environment which can be super useful for first time students.

The first resource is Kattis. This an archive of programming competition problems. There are two special things about this site that I like though. One is that the problems have a lot of data associated with them, you can see this below.

Kattis Problems Data Table

Things like the acceptance ratio, and difficulty can be very useful for finding easy problems to start students out with. Of course, you can also use this to find hard problems to challenge your students with. One technique that is very important is how to identify hard or easy problems without this data. You can use this data to help your students improve their triage skills. In most competitions about 15-20% of the problems are usually quite easy, so finding these early on is very important. I recommend practicing this by finding around 15 problems, then splitting your students into groups. Have them rank each problem from 1-15 with 1 being the easiest. Then show them the actual results (that you took from Kattis), and discuss why certain problems are easier or harder than they thought.

The second resource I want to discuss is Baylor’s Live Archive. This site has all past problems from all ACM ICPC competitions from 1998-2017. That is many more problems than you would ever have time to go over, but I would advise looking at a few problems from the last few years at least. This gives you an idea for the problem trends that are popular. Another great thing about this resource is that you are able to submit your problems as well, which is another way to practice proper problem submission.

These two resources are honestly more than enough to get a good head start in a class, but I also recommend finding some general C++ or Java materials to start out with. Making sure your students have a good foundation in the basics is more important than practicing problems.

Conclusion

Hopefully you found this post about teaching competitive programming interesting, and hopefully some of the resources help you during your class. If you are interested in other posts about teaching computer science. Check out Using LEGO Simple & Powered Machines (SPM) to Teach Students Engineering. If you’re interested in open source projects that may help when teaching, check out our Open Source Project of the Month – Python Word Cloud.