- What is C.P. and why it’s the best way to learn?
- Why it’s also best for your career ?
- Best websites to practice
- Leetcode : a beginner friendly site to learn from
- Which language is the best to practice with
If you are a programmer who wants to improve their understanding and skills in data structures and algorithms, this article is for you.
There are a few ways you can learn about algorithms:
- By reading books.
- Learning through online tutorials (includes : YouTube, other learning sites)
- Working on Projects.
- Competitive Programming (C.P)
Reading books is not for every one and also as you cannot run the programs on the books, I find the switching from books to the computer a little bit cumbersome. Changing gear is always a waste of mental energy.
Learning with online tutorials is okay when you are a beginner but after you master the basics it’s hard to level up. Because most of the tutorials are targeted to beginners.
Working on Projects is a very good way to learn. Most of the programmers learn like this. If you are in a good company where you work on various projects and your responsibility gets tougher, you naturally grow.
The demerits on this are, not working in a place/projects where you can grow quickly. Even counting this demerit, working on projects would be the best choice if it weren’t for competitive programming.
Competitive programming is the best to grow as a programmer because it focuses arguably only on the heart of programming. Which is algorithm. More about this on the next section.
What is C.P. and why it’s the best way to learn
Here’s the official definition from Wikipedia :
Competitive programming (C.P )is a mind sport usually held over the Internet or a local network, involving participants trying to program according to provided specifications.
Essentially what the definition means is that you solve problems using program in a contest. And what is programming ? Yes, you guessed it correctly. It’s designing and implementing algorithms.
So if you get better at C.P, it means you get better at programming. Because programmer write algorithms. I would argue that C.P is the best way to learn algorithm.
Competitive programming or C.P consists of two parts:
- The design of algorithms : it consists of problem solving and mathematical thinking skills.
- The implementation of algorithms : This part is good programming skills.
Okay, so you are already convinced this is something every programmer should do to improve their skills.
But why this is the best way you ask. This seems difficult because all they give you are problems, and to solve this you need high programming skills.
Okay so here is the best part, in the internet there are numerous sites to help you learn this Competitive Programming. And there are thousands of problems from beginner level to legendary level. So you can learn exactly from your level.
Try to think of it as a competing for marathon. Anybody can join but to successfully complete it, you have train. The more training you do, the better you get.
Why it’s also best for your career ?
As this competitive programming contest’s winner are bound to be good programmers. Top companies including Google and Facebook hire people who rank highest in these competitions.
You don’t have to be top C.P If you jut have a good score/rank in online contests, you can easily get into good companies with top notch salary.
For example, in Japan atcoder.jp which is C.P website where you can practice and compete in contest, companies hire directly from the site who have good rank.
You can see the salary here starts from 32~60万円 which is 50%~200% more than the starting average salary. Or if you are in America, you can directly work with Google or Facebook. To see the salary in there, google for yourself 😉 .
Best websites to practice
There are a lot of ranking online and all of them are different. So I will just mention the famous ones here, and some of which I know personally which may not be that famous.
One of the famous C.P contests site where top ranked player routinely solve for the highest score. I have not used this personally.
This site has past problems plus also interview algorithm problems. If you can solve these not only you can participate in the C.P contest, you can connect directly with big companies like Dropbox, LinkedIn etc.
This site also contains past contest problems and interview algorithm questions. This site is beginner friendly and I am currently using site. I am going to describe about this in detail in the next section.
Leetcode : A beginner friendly site to learn from
Currently I am learning and practicing from the site Leetcode. Which in my experience has the best content and experience for beginners.
There are fundamentals course in their website which teach you basic data structures and algorithms to make your fundamentals strong.
And inside courses you can see explanation lectures and practice what you have learned in the courses :
After learning you can practice your skills in these courses.
So if want to start, I would recommend you to start from Leetcode.
Which language is the best to practice with
Okay, there a lot of languages you can practice with. For example in the hacker rank site mentioned above, they support more than 40 languages to practice with.
So the question is are languages are same ? Or if there is a best one, then which it is ?
C++: If your focus is being the best in the C.P contests then this is your best choice. Because this has the fastest time to run and also has extensive library to use from.
most of the famous and successful C.P winner use C++.
Python : Python has been ranked the most popular languages for a few years. And also has thousands of thousands job opening. Specially for machine learning python is the top choices.
If your main focus is to improve your algorithm skills and be a better programmer, this could be a better choice. Because python is easier and also you could get paid handsomely for knowing this language well.
But it’s not recommended if your focus is to win the C.P contests. Because it’s compile time is slower. And in the contests there’s always a time constraint to run the program.
To learn more about this matter , please read this article where the writer explain this in more details with more data.
If you are a person who likes to read with a book or want to supplement learning about this with a book. Here’s a free e-book which covers the basic of C.P.