<p>I think you should develop your practice plans based on the competition that you're preparing for. I'm a high school teacher that has brought teams of students to <a href="http://www.lockheedmartin.com/us/who-we-are/community/codequest.html" rel="nofollow noreferrer">Lockheed Martin's Code Quest</a> for the past several years. Many of the problems can be solved by students towards the end of their year in AP CS. The additional training my students need is with File I/O. </p>

<p>The best way to do that? A quick chalk-talk on I/O and then practice old Code Quest problems. Project Euler problems are excellent challenging programming problems, but they won't prepare my students nearly as well as old Code Quest problems. </p>

<p>Take a look at what contest your students are competing in and work old problems (often readily available on the contest's website). Simulating the experiences that your students will encounter at competition is their best practice. </p>

CC BY-SA 3.0
2017-07-06T22:03:55.770Z
Those are great resources. It's always a pleasure to welcome a teacher to our little community.  Welcome to [cseducators.se]!  I hope we hear more from you in the future.
Ben I.
CC BY-SA 3.0
2017-07-06T21:34:17.323Z
2017-07-06T21:34:17.323Z
iFrame
<p>It takes theory and practice. Theory involves learning algorithms, programming concepts, and when/why/how to use them. It's important to have lots of practice. This is easier when it's fun, for example:</p>

<ul>
<li><a href="http://robocode.sourceforge.net/" rel="nofollow noreferrer">Robocode</a> - think <em>BattleBots</em>, but in Java</li>
<li><a href="https://code.google.com/codejam/" rel="nofollow noreferrer">Google Code Jam</a> - many archived problems, some easy, some hard</li>
<li><em>King of the Hill</em> - this is a <a href="https://bitbucket.org/CoachEd/mysqlchallenge" rel="nofollow noreferrer">game I developed</a> where students battle to insert many records into a simple MySQL table. The student with the most records at the end wins. This is probably the most fun learning activity I have ever presented.</li>
</ul>

CC BY-SA 3.0
2017-07-01T17:07:36.403Z
Those three are very different to each other. Robocode is great for AI-like courses, Code Jam is much more algorithms oriented, and as for KoTH - I assume that whoever writes a tight insert-loop soonest wins?
tucuxi
CC BY-SA 3.0
2017-06-30T13:52:20.360Z
2017-06-30T13:52:20.360Z
Edwin Torres
<p>Websites such as <a href="https://www.codeeval.com" rel="nofollow noreferrer">https://www.codeeval.com</a> and <a href="https://coderbyte.com" rel="nofollow noreferrer">https://coderbyte.com</a> are great for students to practise this type of competitive programming activity.</p>

<p>In order to prepare them for that type of competitive challenge it can be good fun to create opportunities for competition and collaboration early on when you're introducing new programming concepts.</p>

<p>For example: </p>

<ol>
<li>Split students into groups</li>
<li>Give all students some code that is deliberately incomplete or broken.</li>
<li>Award points to the first person who fixes the errors or completes the challenge</li>
<li>Once someone in the team has finished, their job is to support the other students without touching their mouse or keyboard. Award points to the first whole team to complete the challenge.</li>
</ol>

<p>You can get a fast-paced, fun lesson where there's enough challenge to get the brightest students being competitive with enough support for those who take more time to understand and complete the work.</p>

CC BY-SA 3.0
2017-06-30T16:04:51.870Z
2017-06-30T16:04:51.870Z
pddring
<p>I can recommend giving your students some tasks from Codility, like this one on <a href="https://app.codility.com/programmers/lessons/1-iterations/" rel="nofollow noreferrer">Iterations</a> or these ones on <a href="https://app.codility.com/programmers/lessons/6-sorting/" rel="nofollow noreferrer">Sorting</a>. There are several different tasks sorted by topics and a PDF with explanation provided for each topic. Another benefit of those is that your students will have an opportunity to practice for job interview tasks they will face in the future.</p>

CC BY-SA 4.0
2020-08-05T13:43:52.327Z
Nice, helpful first answer.  Welcome to [cseducators.se]!
Ben I.
CC BY-SA 4.0
2020-08-05T10:31:10.010Z
2020-08-05T10:31:10.010Z
falxconua
<p>I'll answer the second part before the first one:</p>

<p>I'd recommend <a href="https://projecteuler.net/" rel="noreferrer">Project Euler</a>. Many problems, at varying difficulties. Just starting to solve them, from the start, and sticking to it. The variation in the problems gives students a very handy skill set for solving problems. </p>

<p>As for the competitive programming, Project Euler is arguably still useful here. But I think it would be even better to form a few groups of students (2-3 students per group). Ask each group to write a program\algorithm that would complete some task (such as pathfinding or something similar) and the algorithm that completes the task in the best way (you can decide how to define "best", but I'd go for minimal complexity and execution time) wins. This teaches them teamwork as well.</p>

CC BY-SA 3.0
2017-06-30T10:17:10.793Z
I'm not a big fan of Project Euler. A lot of the problems are maths problems, not algorithm problems, they both require and provide little insight into computer science. (Unless the insight you want to convey is that domain knowledge often beats programming knowledge.)
Jörg W Mittag
CC BY-SA 3.0
2017-06-30T10:24:47.577Z
@JörgWMittag The idea is giving them problem solving skills.
ItamarG3
CC BY-SA 3.0
2017-06-30T12:21:01.737Z
@JörgWMittag I very much disagree with you about Project Euler. I once had (but now can't find) a list of p.e. problems broken down by CS principle. They really are fairly brilliant problems. However, if you want something less math *focused*, you may enjoy [Programming Praxis](https://programmingpraxis.com).
Ben I.
CC BY-SA 3.0
2017-06-30T09:20:37.567Z
2017-06-30T09:20:37.567Z
ItamarG3
<p>You need to help your students develop <a href="https://cseducators.stackexchange.com/q/690/2">algorithmic thinking</a>, I would think. As wythagoras mentions, there isn't really an easy way to teach this—like many skills, it is best developed by practising, doing lots of different problems across a broad range of topics.</p>

<p>I've mentioned <a href="https://www.codewars.com/" rel="noreferrer">Codewars</a> in a previous answer, and there are various other 'online judges' available in the <a href="https://github.com/tayllan/awesome-algorithms#online-judges" rel="noreferrer">awesome-algorithms</a> list.</p>

<p>If you want to teach some of the most common algorithms that can just be 'slotted in' to a problem, there are some resources available under the <a href="https://github.com/tayllan/awesome-algorithms#websites" rel="noreferrer">'Websites'</a> section. This is the bit where you <strong>can</strong> help—teaching sorting algorithms through <a href="https://cseducators.stackexchange.com/q/339/2">'human sorting'</a> is entertaining and does help to introduce and reinforce the algorithms.</p>

<p>Ultimately, you can't <strong>teach</strong> problem-solving in the same way as just teaching a specific topic, but you can facilitate it through adapting your lessons to <em>require</em> some problem-solving rather than just telling your students what they need to learn directly. Giving them the resources to practise writing algorithms from a text-based 'design brief' is probably the best you can do here, so I highly recommend it for your problem.</p>

CC BY-SA 3.0
2017-06-30T09:16:39.373Z
2017-06-30T09:48:20.427Z
2017-06-30T09:48:20.427Z
Aurora0001
<p>Learning and teaching competitive programming depends a lot on what level the students already have. The first step is getting to know basic features of a programming language, preferably C, C++ or Pascal, since some contests require to use one of these. Out of these, C++ is used most.</p>

<p>These basic features include at least: variables, strings, input and output, if and else, while, for, basic manipulation of arrays. In fact, this is usually enough to (theoretically) be able to solve every problem. Of course, built-in sorting functions and things like inteprenting characters as numbers are useful as well. As you say, this is mostly just knowing, and less insight.</p>

<p>Improve someone's problem-solving ability is in the beginning mainly practising, for the problems you don't really need any textbook algorithm or other, more complicated techniques. Besides explaining solutions to problems that the student can't solve <em>but already tried sufficiently hard</em>, there is not very much to teach. The "tried sufficiently hard" is important: you learn this problem-solving ability the best when doing this. </p>

<p>After that, on a higher level (e.g. National Final Round, or even the IOI), the students need some standard textbook algorithms (e.g. Dijkstra's algorithm) and other techniques, and you can teach this. You can find all the topics you might want to teach in the IOI syllabus. </p>

CC BY-SA 3.0
2017-06-30T08:52:33.650Z
2017-06-30T09:38:22.723Z
2017-06-30T09:38:22.723Z
wythagoras
<p>Having coached several teams that have been beaten soundly by Steve Skiena's teams, I will recommend his <a href="https://smile.amazon.com/Programming-Challenges-Contest-Training-Computer/dp/0387001638/ref=smi_www_rco2_go_smi_g2609328962?_encoding=UTF8&amp;%2AVersion%2A=1&amp;%2Aentries%2A=0&amp;ie=UTF8" rel="nofollow noreferrer">book on Amazon</a>.  The Table of Contents includes:</p>

<ul>
<li>Data Structures</li>
<li>Sorting</li>
<li>Combinatorics</li>
<li>Number Theory</li>
<li>Graph Algorithms</li>
</ul>

<p>None of these chapters will turn a beginner into an expert, but with a bit of prerequisite knowledge, it can help bridge the gap between "good student in class" and "good programming contestant".</p>

CC BY-SA 3.0
2017-06-30T13:47:40.760Z
Adding an abridged table-of-contents of Skiena's book to your answer would make it better. As it is, only those that already know the book or follow the link to browse its contents will understand what it is all about: providing a basic set of tools and discussing the main problem types found in ICPC-lilke programming contests
tucuxi
CC BY-SA 3.0
2017-06-30T14:56:32.317Z
Thank you!  I'm still learning what makes answers valuable.
Chris M.
CC BY-SA 3.0
2017-06-30T15:01:44.810Z
Please also summarize the content of those chapters. The goal is for this answer to be useful even without the link.
thesecretmaster
CC BY-SA 3.0
2017-06-30T12:59:36.293Z
2017-06-30T14:55:43.357Z
2017-06-30T14:55:43.357Z
Chris M.
<p>When I participated in the ACM International Collegiate Programming Contest back in college, our preparation involved a LOT of practice. We poured through the ACM-ICPC archives and worked on doing the old problems. Our adviser went over a few key algorithms and concepts that we'd almost certainly run into (searches, sorts, etc).</p>

<p>I would highly suggest looking at the <a href="https://icpcarchive.ecs.baylor.edu/" rel="nofollow noreferrer">ACM-ICPC Live Archive</a> for an insane amount of sample programming problems.</p>

CC BY-SA 3.0
2017-07-07T16:53:07.637Z
2017-07-07T16:53:07.637Z
Tammy Weeks
<p>Competitive programming is mainly about problem-solving skills. Students are given a problem and they have to write a short program to solve it. The students are given a problem for which they have to solve within the stipulated time. Efficiency or maintainability or portability of the code is not graded; however, the is a fixed amount of time given for each program to run.</p>

<p>Here is an example problem: <a href="https://www.codechef.com/LTIME49/problems/SHDWCMP" rel="noreferrer">https://www.codechef.com/LTIME49/problems/SHDWCMP</a></p>

<p>This kind of programming does not require a thorough knowledge of the language (for example, in C++, you'd never need to use classes or templates or anything as such) but it requires the student to be able to find ways to convert a word problem into a coding problem.</p>

<ol>
<li><p>How do you go about training a student for competitive programming? </p></li>
<li><p>Teaching the language is not very hard but how do you improve someone's problem-solving ability?</p></li>
</ol>

CC BY-SA 3.0
2017-06-30T11:04:23.803Z
You may want first to fix what kind of problems do you want them to solve ? Raw Algorithm ? Software design ? Low level problem ? (Performance problems, IO Management, Cache, Memory, Floating precision limits, ...). To be honest, unless you're with very beginners, I disapprouve the fact to have your students write the first solution to the problem they think about, because it often miss edges cases, low level related problems, code written badly and not maintenable,... everything we hate to see as professionals even if "it works"
Walfrat
CC BY-SA 3.0
2017-06-30T14:48:34.587Z
@Walfrat: The type of problems used in competitive programming are mostly about algorithm (pick a solution with the time/space complexity that can pass the size of the test case), and some knowledge of the library offered by the language is sometimes needed (time complexity of the built-in data structure). The problems are also usually designed with edge cases or two, so it's a nice way to train them to think through them before coding. On the other hand, competitive programming places less emphasis on writing maintainable/portable code - which should be taught in a different class.
nhahtdh
CC BY-SA 3.0
2017-06-30T15:01:11.437Z
@nhahtdh Then our author should add that : Training students to resolve problems in a Time Frame with the best time/space complexity compromise. Note that sometimes, just translate a given algorithm to C++ solution is not so obvious (dijikstra, handle nodes already visited for instances)
Walfrat
CC BY-SA 3.0
2017-07-01T14:55:37.937Z
Please feel free to continue your discussion of competitive programming skills [in chat](http://chat.stackexchange.com/rooms/61419/discussion-on-question-by-yashas-how-to-teach-competitive-programming).
thesecretmaster
<secondary-education><best-practice>
How to teach competitive programming?
# How to teach competitive programming?

(Asked by: username_0 on 2017-06-30)

Competitive programming is mainly about problem-solving skills. Students are given a problem and they have to write a short program to solve it. The students are given a problem for which they have to solve within the stipulated time. Efficiency or maintainability or portability of the code is not graded; however, the is a fixed amount of time given for each program to run.

Here is an example problem: <https://www.codechef.com/LTIME49/problems/SHDWCMP>

This kind of programming does not require a thorough knowledge of the language (for example, in C++, you'd never need to use classes or templates or anything as such) but it requires the student to be able to find ways to convert a word problem into a coding problem.

1. How do you go about training a student for competitive programming?
2. Teaching the language is not very hard but how do you improve someone's problem-solving ability?

**Tags:** secondary-education, best-practice

> **Comments:**
> **username_1**: You may want first to fix what kind of problems do you want them to solve ? Raw Algorithm ? Software design ? Low level problem ? (Performance problems, IO Management, Cache, Memory, Floating precision limits, ...). To be honest, unless you're with very beginners, I disapprouve the fact to have your students write the first solution to the problem they think about, because it often miss edges cases, low level related problems, code written badly and not maintenable,... everything we hate to see as professionals even if "it works"  
> **username_2**: @username_1: The type of problems used in competitive programming are mostly about algorithm (pick a solution with the time/space complexity that can pass the size of the test case), and some knowledge of the library offered by the language is sometimes needed (time complexity of the built-in data structure). The problems are also usually designed with edge cases or two, so it's a nice way to train them to think through them before coding. On the other hand, competitive programming places less emphasis on writing maintainable/portable code - which should be taught in a different class.  
> **username_1**: @username_2 Then our author should add that : Training students to resolve problems in a Time Frame with the best time/space complexity compromise. Note that sometimes, just translate a given algorithm to C++ solution is not so obvious (dijikstra, handle nodes already visited for instances)  
> **username_3**: Please feel free to continue your discussion of competitive programming skills [in chat](http://chat.stackexchange.com/rooms/61419/discussion-on-question-by-yashas-how-to-teach-competitive-programming).  

---

## 9 answers

### Answer by username_13 on 2017-06-30. Score: 8

Learning and teaching competitive programming depends a lot on what level the students already have. The first step is getting to know basic features of a programming language, preferably C, C++ or Pascal, since some contests require to use one of these. Out of these, C++ is used most.

These basic features include at least: variables, strings, input and output, if and else, while, for, basic manipulation of arrays. In fact, this is usually enough to (theoretically) be able to solve every problem. Of course, built-in sorting functions and things like inteprenting characters as numbers are useful as well. As you say, this is mostly just knowing, and less insight.

Improve someone's problem-solving ability is in the beginning mainly practising, for the problems you don't really need any textbook algorithm or other, more complicated techniques. Besides explaining solutions to problems that the student can't solve *but already tried sufficiently hard*, there is not very much to teach. The "tried sufficiently hard" is important: you learn this problem-solving ability the best when doing this.

After that, on a higher level (e.g. National Final Round, or even the IOI), the students need some standard textbook algorithms (e.g. Dijkstra's algorithm) and other techniques, and you can teach this. You can find all the topics you might want to teach in the IOI syllabus.


---

### Answer by username_10 on 2017-06-30. Score: 7

I'll answer the second part before the first one:

I'd recommend [Project Euler](https://projecteuler.net/). Many problems, at varying difficulties. Just starting to solve them, from the start, and sticking to it. The variation in the problems gives students a very handy skill set for solving problems.

As for the competitive programming, Project Euler is arguably still useful here. But I think it would be even better to form a few groups of students (2-3 students per group). Ask each group to write a program\algorithm that would complete some task (such as pathfinding or something similar) and the algorithm that completes the task in the best way (you can decide how to define "best", but I'd go for minimal complexity and execution time) wins. This teaches them teamwork as well.

> **Comments:**
> **username_11**: I'm not a big fan of Project Euler. A lot of the problems are maths problems, not algorithm problems, they both require and provide little insight into computer science. (Unless the insight you want to convey is that domain knowledge often beats programming knowledge.)  
> **username_10**: @JörgWMittag The idea is giving them problem solving skills.  
> **username_5**: @JörgWMittag I very much disagree with you about Project Euler. I once had (but now can't find) a list of p.e. problems broken down by CS principle. They really are fairly brilliant problems. However, if you want something less math *focused*, you may enjoy [Programming Praxis](https://programmingpraxis.com).  

---

### Answer by username_12 on 2017-06-30. Score: 5

You need to help your students develop [algorithmic thinking](https://cseducators.stackexchange.com/q/690/2), I would think. As username_13 mentions, there isn't really an easy way to teach this—like many skills, it is best developed by practising, doing lots of different problems across a broad range of topics.

I've mentioned [Codewars](https://www.codewars.com/) in a previous answer, and there are various other 'online judges' available in the [awesome-algorithms](https://github.com/tayllan/awesome-algorithms#online-judges) list.

If you want to teach some of the most common algorithms that can just be 'slotted in' to a problem, there are some resources available under the ['Websites'](https://github.com/tayllan/awesome-algorithms#websites) section. This is the bit where you **can** help—teaching sorting algorithms through ['human sorting'](https://cseducators.stackexchange.com/q/339/2) is entertaining and does help to introduce and reinforce the algorithms.

Ultimately, you can't **teach** problem-solving in the same way as just teaching a specific topic, but you can facilitate it through adapting your lessons to *require* some problem-solving rather than just telling your students what they need to learn directly. Giving them the resources to practise writing algorithms from a text-based 'design brief' is probably the best you can do here, so I highly recommend it for your problem.


---

### Answer by username_14 on 2017-06-30. Score: 3

Having coached several teams that have been beaten soundly by Steve Skiena's teams, I will recommend his [book on Amazon](https://smile.amazon.com/Programming-Challenges-Contest-Training-Computer/dp/0387001638/ref=smi_www_rco2_go_smi_g2609328962?_encoding=UTF8&%2AVersion%2A=1&%2Aentries%2A=0&ie=UTF8). The Table of Contents includes:

* Data Structures
* Sorting
* Combinatorics
* Number Theory
* Graph Algorithms

None of these chapters will turn a beginner into an expert, but with a bit of prerequisite knowledge, it can help bridge the gap between "good student in class" and "good programming contestant".

> **Comments:**
> **username_7**: Adding an abridged table-of-contents of Skiena's book to your answer would make it better. As it is, only those that already know the book or follow the link to browse its contents will understand what it is all about: providing a basic set of tools and discussing the main problem types found in ICPC-lilke programming contests  
> **username_14**: Thank you!  I'm still learning what makes answers valuable.  
> **username_3**: Please also summarize the content of those chapters. The goal is for this answer to be useful even without the link.  

---

### Answer by username_15 on 2017-07-07. Score: 3

When I participated in the ACM International Collegiate Programming Contest back in college, our preparation involved a LOT of practice. We poured through the ACM-ICPC archives and worked on doing the old problems. Our adviser went over a few key algorithms and concepts that we'd almost certainly run into (searches, sorts, etc).

I would highly suggest looking at the [ACM-ICPC Live Archive](https://icpcarchive.ecs.baylor.edu/) for an insane amount of sample programming problems.


---

### Answer by username_4 on 2017-07-06. Score: 2

I think you should develop your practice plans based on the competition that you're preparing for. I'm a high school teacher that has brought teams of students to [Lockheed Martin's Code Quest](http://www.lockheedmartin.com/us/who-we-are/community/codequest.html) for the past several years. Many of the problems can be solved by students towards the end of their year in AP CS. The additional training my students need is with File I/O.

The best way to do that? A quick chalk-talk on I/O and then practice old Code Quest problems. Project Euler problems are excellent challenging programming problems, but they won't prepare my students nearly as well as old Code Quest problems.

Take a look at what contest your students are competing in and work old problems (often readily available on the contest's website). Simulating the experiences that your students will encounter at competition is their best practice.

> **Comments:**
> **username_5**: Those are great resources. It's always a pleasure to welcome a teacher to our little community.  Welcome to [cseducators.se]!  I hope we hear more from you in the future.  

---

### Answer by username_6 on 2017-06-30. Score: 2

It takes theory and practice. Theory involves learning algorithms, programming concepts, and when/why/how to use them. It's important to have lots of practice. This is easier when it's fun, for example:

* [Robocode](http://robocode.sourceforge.net/) - think *BattleBots*, but in Java
* [Google Code Jam](https://code.google.com/codejam/) - many archived problems, some easy, some hard
* *King of the Hill* - this is a [game I developed](https://bitbucket.org/CoachEd/mysqlchallenge) where students battle to insert many records into a simple MySQL table. The student with the most records at the end wins. This is probably the most fun learning activity I have ever presented.

> **Comments:**
> **username_7**: Those three are very different to each other. Robocode is great for AI-like courses, Code Jam is much more algorithms oriented, and as for KoTH - I assume that whoever writes a tight insert-loop soonest wins?  

---

### Answer by username_8 on 2017-06-30. Score: 2

Websites such as <https://www.codeeval.com> and <https://coderbyte.com> are great for students to practise this type of competitive programming activity.

In order to prepare them for that type of competitive challenge it can be good fun to create opportunities for competition and collaboration early on when you're introducing new programming concepts.

For example:

1. Split students into groups
2. Give all students some code that is deliberately incomplete or broken.
3. Award points to the first person who fixes the errors or completes the challenge
4. Once someone in the team has finished, their job is to support the other students without touching their mouse or keyboard. Award points to the first whole team to complete the challenge.

You can get a fast-paced, fun lesson where there's enough challenge to get the brightest students being competitive with enough support for those who take more time to understand and complete the work.


---

### Answer by username_9 on 2020-08-05. Score: 1

I can recommend giving your students some tasks from Codility, like this one on [Iterations](https://app.codility.com/programmers/lessons/1-iterations/) or these ones on [Sorting](https://app.codility.com/programmers/lessons/6-sorting/). There are several different tasks sorted by topics and a PDF with explanation provided for each topic. Another benefit of those is that your students will have an opportunity to practice for job interview tasks they will face in the future.

> **Comments:**
> **username_5**: Nice, helpful first answer.  Welcome to [cseducators.se]!  

---

