A lot is going on to encourage kids to code. Many prominent personalities are evangelizing ‘everyone should learn how to code’ because of the realization of how much of a necessary 21st-century skill it is for the future.
Getting kids to participate in coding competitions is one of the best ways to encourage them to learn how to code. We all know how motivating prizes can be. Besides, who does not like to win and to be rewarded for it?
Coding competitions are a great way for students to apply what they know in a fun context and create something of importance to them. By entering a coding competition, kids can get that real-world experience of coding to solve a problem or hone their coding skills.
If you need to have a better understanding of how getting your kids to participate in coding competitions can significantly benefit them in the long run, you can take a look at our previous blog The Benefits of Coding Competitions.
When some people hear the term ‘competitive coding’ what usually comes to mind are images of hackers pulling all-nighters trying to build the best app or website over a weekend (hackathons). So the purpose of this blog is to introduce you to the world of competitive coding, what it is, and how you can get your child involved in it.
Here is a simple guide to what competitive coding is all about so you can get a better understanding and not be like those who are confusing it with hackathons .
What is Competitive Coding?
Competitive programming is an intellectual sport usually held over the Internet or a local network, involving participants competing using code according to provided specifications within a restricted timeframe.
Programming competitions generally are all about algorithmic problem solving, data structure knowledge, and implementation skills.
Typical categories of tasks: combinatorics, number theory, graph theory, geometry, string analysis, data structures, and artificial intelligence.
Contestants, who are referred to as sport programmers varying in number from tens to several thousand, are required to write solutions (in any programming language they are comfortable with) capable of solving logical or mathematical problems presented by judges.
Judging is done online and is based mostly upon the number of problems solved and time spent on writing successful solutions, quality of output produced, program size, etc.
Competitive programming is recognized and supported by several multinational software and Internet companies, such as Google and Facebook, who host programming competitions regularly.
The biggest competitive coding competitions consist of the best of the best gathering in one location to compete for medals, trophies, or even cash.
Competitive programming is most popular among high school and college students overseas but has been growing in the United States.
History of Competitive Programming
Due to the growth of the Internet, interest in programming challenges has grown extensively since the beginning of the new millennium because it facilitates coding contest sites to host international contests online.
The oldest contest is the ACM-ICPC (International Collegiate Programming Contest), which originated in the 1970s and has grown to span across 88 countries.
Skills Required for Competitive Programming
- Algorithm Skills
- Basic Math Skills
- Programming Skills
- Typing Speed Skills
- Debugging Skills
- Brute force searching using the entire search space
- Beating the time limit
- Optimizing the search
- Binary search
- Dividing the coding problem into smaller parts
- Dynamic programming
- Determining problem state
- Fast and elaborate recursive backtracking
How to Get Started
The prerequisite for competitive programming is a good working knowledge of your favorite programming language, and some basic data structures.
Step 1: Choose a programming language
It’s recommended to choose a programming language you’re most comfortable with – one you have at least have 3–4 months of experience with.
Due to its speed, C++ is by far the most popular language of choice for competitive programmers. Most resources/solutions will probably be written in C++. But if you’re new to coding, Python might be the best choice due to its easy syntax and predefined library functions.
Step 2: Learn Algorithm concepts and basic Data Structures
To reach an optimal solution nearly every coding problem will require the usage of a specific data structure or algorithms. Therefore, knowing the basics of these techniques before you start is compulsory.
Reading about Algorithms
The USACO Training Pages will provide you with a structured and organized way of learning the basic algorithms you need in competitive programming.
The training pages provide tutorials on some basic but very important algorithms, such as Greedy, DFS/BFS, binary search, dynamic programming, etc. plus a host of practice problems to hone your skills.
Outside of USACO training pages, there’s a lot of other material out there that can be useful for learning algorithms such as the CLRS Introduction to Algorithms textbook which is a good choice. However, textbooks aren’t usually the most efficient option as there will likely be some useless information in some textbooks.
You can also look at slides and practice problems for Stanford’s CS97SI: Introduction to Programming Competitions course.
The TJHSST Lecture Archive allows you to browse through years of lectures and high-quality handouts to learn about whatever topic you want to focus on.
Step 3: Learn about Time and Space complexity
There’s usually more than one solution to a problem. Online judges rank the optimal solution based on its performance.
Performance is measured through Time complexity and Space complexity.
Time complexity refers to the execution time of all the operations in a program. All operations of a computer take constant time. Execution time also depends on external factors like the hardware but these factors are ignored by online judges.
The execution time is considered in three scenarios:
- Best case
- Average case
- Worst case
The worst case is considered as the execution time for judging the performance of code most of the time.
Step 4: Practice makes perfect
Just reading about algorithms alone will not make you a better coder. You have to practice solving problems. Practice solutions and different approaches day and night and learn from experienced coders. The more you code, the more you’ll be able to find a suitable data structure and/or algorithm for a specific problem.
Step 5: Compete
And the most effective way to practice is by competing. There’s no substitution for real competition and the time crunch and pressure that comes with it.
If you’re a teenager, ACM-ICPC is the premier programming competition for college students where they compete in teams of three to solve ten difficult problems in five hours.
Regional contests are held once a year in the fall, and winners of those are invited to the World Finals in May to compete against other top universities from around the world.
A great way to improve your skills when learning to code is by solving different types of coding challenges and puzzles.
Codeforces is a pretty good choice if you want to compete regularly. It offers two-hour online contests once or twice every week. It has a great interface and you’ll get access to a huge collection of solutions to problems from their past competitions in case you get stuck.
TopCoder also has a large collection of problems along with USACO Training Pages and USACO Past Contests. HackerRank and CodeChef also have periodic online contests.
Google Code Jam and Facebook Hacker Cup are two of the largest sponsor programming competitions held yearly.
The key to maximizing the benefits of competitive programming is to be clear about your goals. There is no shortage of opportunities to learn and to participate in competitive programming. There are various kinds of programming contests for different tastes and interests.
Competitive coding may not open the doors to the professional world to you, but it can help you to improve your logical and analytical skills.
Plus programming competitions are a fun activity, so at worst, you should have fun if you’re into coding.