C++ for competitive programming

C++ is one of the oldest and most popular languages, and it is also popular in competitive programming because of its fast I/O process and libraries.

Competitive programming helps you develop problem-solving skills. You will improve your solution thinking and writing clean and short code skills.

Top MNCs and startups look for candidates with good problem-solving skills, regardless of whether you are from tier 1 or tier 3 college. If you are good at competitive programming, it will help you crack coding interviews.

This article explains why you should choose C++ for your competitive programming journey.

Before that, let’s understand what competitive programming is.

What is competitive programming?

Competitive programming is a code competition for solving a given problem using the best algorithm within the shortest time. Which adheres to time and space complexity.

Now let’s see why most developers choose c++ for competitive programming.

Why C++ over Java and Python?

When you compete in contests, time limits come into play. Every second can give the highest or the lowest ranks, so time plays an important role in competitive programming. That’s why c++ is most preferred. It processes the large input fast and gives output very fast.

Because C++ has its Standard Template library. Which has built-in functions and methods that already have the instructions.

We can import the library at the top of our C++ and start working, so we don’t have to code everything from scratch. We can import the libraries and start coding.

For working with math equations, we import

#include <math.h>
// OR
#include <cmath>Code language: C++ (cpp)

But we can also import one standard library that contains other libraries’ information.

#include <std/c++>Code language: C++ (cpp)

C++ is an object-oriented programming language.

C++ manages its memory very well. It has a garbage collection algorithm that removes unused data when the program gets compiled for execution.

It has the pointer concept, where you can modify the reference objects.

Who can participate in Competitive programming?

Even if you are a beginner, you can participate in competitive programming using platforms like CodeChef. Leetcode, code studio, and hacker rank.

To participate in competitive programming, you should have some intermediate knowledge of c++ and DSA.

Below I have created a table to understand which concepts you should learn if you prepare for competitive programming.

Concept Name Concept Category Difficulty Level For Competitive Programming
1D, 2D & 3D Arrays C++ Intermediate Medium
Sorting Algorithm ( Insertion, Selection & Bubble Sort ) DSA Medium
Working with Strings C++ Basic to Intermediate Easy
Pointers C++ Advanced Medium
Vectors DSA Medium
Bit Manipulation C++ Intermediate Medium
Recursion C++ Advanced Medium – Hard
Time and Space Complexity DSA Medium
Object Oriented Programming C++ Advanced Medium
Lists DSA Hard
Stacks DSA Hard
Queues DSA Hard
Graphs DSA Hard
Basic To Advanced Dynamic Programming DSA Hard
STL Containers DSA Medium
Big Integers DSA Medium
Greedy Algorithms DSA Hard
SQRT Decomposition DSA Hard
Shortest Path Algorithm DSA Medium
Geometric Algorithm DSA Hard
Number Theory DSA Medium
Lazy Propagation DSA Medium
Pigeonhole Principle DSA Hard
concepts to learn for competitive programming

The best way to practice competitive programming would be to solve the problems on the topic you have learned.

Suppose you have learned arrays, go to platforms like CodeChef, and leetcode filter the problems based on the concepts, then you can try to solve them.

It will help you build muscle memory and helps you retain what you have learned.

Resources to learn C++

I have curated a list of resources for learning C++.

Resource Name Resource Category Resource Link Author
Learn C++ in 1 hour YouTube video Video Link Programming With Mosh
C++ Tutorial For Beginners YouTube video Video Link Freecodecamp
C++ in 31 Hours YouTube video Video Link Freecodecamp
Basic of C++ and DSA Course Course Link Coding Ninjas
Learn C++ Programming, Beginners to Advanced Course Course Link Abdul Bari
CPP Essentials Course Course Link Coding Minutes
C++ Master Course Course Course Link Coding blocks
c++ learning resources

Resources to learn Competitive Programming:

I have curated a separate list of resources for learning Competitive Programming

Resource Name Resource Name Resource Link Author
Learn Competitive Programming Course Course Link Coding Ninjas
Competitive Programming Series YouTube playlist Playlist Link Luv
Competitive Programming series YouTube playlist Playlist Link Love Babbar
Complete DSA Course YouTube Playlist Playlist Link Love Babbar
Competitive Programming beginners C++ challenges Course Course Link Learn Coding Online
Competitive Programming Course Course Link Coding Blocks
DSA Essentials Course Course Link Coding Minutes
Competitive Programming Essentials, Master Algorithms Course Course Link Coding Minutes
competitive programming learning resources

Platforms to practice competitive programming

Below I have created a table where you can practice competitive programming using c++

Platform name Platform link
Codechef Link to CodeChef
Leetcode Link to leetocde
Codeforces Link to codeforces
Hackerrank Link to hackerank
Code Studio Link to code studio
Hacker earth Link to hacker earth
Exercism Link to exercism
the platform links to practice competitive programming

Summary

I hope you have the idea of why you should choose c++ for competitive programming.

Make sure to master the fundamentals and try to solve the questions as many as possible, so you don’t forget the fundamentals.

 

Thanks for your time!

 

By Md Jakaria Nur

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *