How to Start Competitive Programming(CP)
To all the people, who are asking me about how to start Competitive Programming(CP). So here I’m just sharing what I followed, everyone has different approaches, so I’m just sharing mine.
- First learn the language, start with C and then switch to C++ or Python or Java whatever you prefer, I don’t think language is a barrier in the starting, but make sure you have good knowledge of at least one language. You can practice language related questions on HackerRank or there are also many other sites, so depends on you.
- Then start learning basic data structures(ds) and algorithms(algo), see the list of data structures here: https://www.geeksforgeeks.org/data-structures and algorithms: https://www.geeksforgeeks.org/fundamentals-of-algorithms
- You can search on Google and on Quora also to get the list of data structures and algorithms.
- Also learn about time complexity, how to calculate time complexity and all.
- To learn an algorithm: Just pick up an algorithm from the above list, suppose it is a merge sort, then search the topic on Google, you will find many good articles on that algorithm, so pick up any article (e.g., geeks for geeks, hackerearth, codeforces, medium, etc.) whatever you find good and if still you’re not able to understand the algorithm, then search on YouTube, you will find many good videos explaining that algorithm(e.g., Tushar Roy, etc.) where you can easily understand the working of an algorithm.
- So after learning an algorithm, then at least practice 4–5 problems on that algorithm, it will help you to understand the algorithm clearly.
- You can practice questions on Spoj, Codeforces, Codechef, Hackerearth, HackerRank, etc.
- After having some basic knowledge of ds and algo, start practicing questions from easy level, then increase the level.
- Also start participating in the contests as much as possible(e.g., codeforces contests, codechef long contests, etc.). Also participate in Google Code Jam, Google Kick Start, Facebook HackerCup and ACM ICPC, search on google if you’ve never heard these names before.
- Practice is the only key here. Participate in the contests as much as possible and practice questions according to your level and keep increasing the level.
- When you participate in a contest, then try to give your best and after the contest try to solve those problems again that you were not able to solve in the contest, and still if you’re not able to solve the problem then see the editorial and if it requires a new algorithm then learn that algo and then try to solve the problem and still if you’re not able to understand the editorial, then contact those people who solved that question, I contacted people on Codeforces, at least one person will reply you and explain you, and still if you’re not able to understand then leave that problem, because it requires higher level that you don’t have this time, so try the problem after getting that level.
- Try to create a programming group around you, if you don’t have anyone around you then make a group online, it will help you to keep motivated towards programming and learn more. And after solving a problem, also read other’s code, because it will help you to improve your coding style and suppose if someone wrote a very small code to find or check something, then you will learn a lot.
- Make small goals like learn a new algorithm daily and then give 2–3 days to practice on that algorithm. If you were able to solve 3 problems in the last contest then try to solve 4 problems next time in that contest, you will not feel the difference in one day, but after 2–3 months you will see the lots of improvement in you.
- You have to come out of your comfort zone every time to increase your level(e.g., easy to medium, medium to hard, etc.)
- Sometimes, we feel frustrated when we’re not able to solve a question, even after putting so much efforts, so I suggest you to take 1–2 days break and then start again, this time you will feel good. So take break time to time(in 7 days or in 15 days), this is also important to get a good mindset.
- Practice is the only key to do good in CP. Just remember one thing: “Every expert was once a beginner”.
When I was doing CP, so I followed all these steps, so just shared my experience. I’ve tried my best to cover everything related to CP.
I have no intend to offend anyone and this is my first blog, so I’m really sorry for the mistakes if there is any.
Keep learning and improving yourself :)