An Overall Step by step Guideline to competitive programming for Very Beginners. [collected]

VERY VERY IMPORTANT FOR BEGINNERS AND PROGRAMMING ENTHUSIASTS!!!!!!!!!!!

Hello everyone,

I had been looking forward to give this post for quite a long time. However due to my busy schedule and other consequences, I could not. As I have observed, most of you are very much interested in competitive programming but most of you don’t know what to do or where to start from. So, in this post. I have tried to provide a tentative step by step guideline that you can follow in order to improve your skills and knowledge in competitive programming. The post is quite long and informative. So, Sorry for testing your patience. . Ok..Here are the steps to go according to my suggestion.


1. Learn the basics(Types of Variables, If-Else Logic, Loop, Array, Function, String) of a Structural Programming Language(C is preferable). Then move to learning any Object Oriented Programming(C++/ Java). You don’t have to learn all the concepts thoroughly of Object Oriented Programming(OOP). The concepts you need to learn are mainly Class, Object, Function Overloading, Operator Overloading, Inheritance. For competitive programming, C++ is the best I think. So, I recommend you to learn C++ immediately after C.


2. Assuming that you have finished learning the basics of OOP, now you can switch to actual learning of some advanced and interesting topics that will change your way of thinking a lot. At first, try to learn STL(Standard Template Library). You can’t finish learning all of them. The topics of STL that you must and should learn are:-
Vector, Map, List, String(Class), Set, Pair, Queue, Stack, Priority Queue, Double Ended Queue.
A very good resources for learning this could be:-
http://www.cplusplus.com/reference/

3. As you are learning STL, at the same time start problem solving in online judges. According to me, the best platform for beginners is Codeforces. Try the A and B number problems of Codeforces. They are mainly implementation related problems and will help you a lot to get familiar with competitive programming. For beginners, URI Online Judge is also very good and encouraging. . You can also try the easy challenges of Hackerrank. They contain some easy but very classical problems.Also, you must attend regular contests. Codeforces arranges 1 or 2 contests each week. Even though you might not be able to solve in the first few contests, I can assure you this will help you a lot to reach the next level. Only practicing would never help you to upgrade your level. Now one more very important thing here..Besides STL,you must learn some basic problem solving techniques. I am mentioning some of them- Greedy approach,Sorting using STL, sorting using structure, binary search, Divide and Conquer approach,basic of bitwise operators, elementary math(GCD, LCM, Sieve algorithm), modular arithmetic. Of course while learning, solve some problems related to the topic otherwise your learning will not be even half complete.

4. Try to spend at least 2-3 months practicing in the way of step 2 and 3 mentioned. Then start learning advanced topics. Here there is also a good thing to maintain a sequence while learning. I am mentioning them in the next few steps. Before going further, one very important advice for you. If you cannot solve a problem, don’t waste whole day thinking about it. This is a very dull approach. Spend 5-6 hours brainstorming. If you can’t solve, you MUST AND MUST AND MUST AND MUST see the editorial or the solution of other persons of the same problem. Many people don’t do this.Once again I am repeating, if you want to improve you MUST AND MUST AND MUST AND MUST AND MUST see other people’s codes and editorials when you are unable to solve a problem. If you are still unable to understand the editorial or solution,then just leave the problem and move to another one.

5. Learn basic math related topics. They are- Number theory, Combinatorics(Permutation and Combination mainly, Inclusion Exclusion, Pigeonhole Principle), Modular Inverse Calculation, Game Theory,Probability, Use of bitmasks, basic geometry and trigonometry. For learning, the best resources are Codeforces, Lightoj and UVA Online Judge.
Also, as you have good knowledge about STL now, start solving Data Structures related problems in Hackerrank, Codeforces,URI and UVA.

6. Learn elementary graph theory. Many of you think graph theory is a hard topic. But actually if you know about vector,queue,stack and map in STL, it is not that hard. After having basic knowledge,in this step, learn the two basic algorithm BFS(Breadth First Search) and DFS(Depth First Search). Try to solve the LIghtoj problems. Also search in CodeChef, UVA and Codeforces for solving problems. I order to do well in graph theory, you must be very very good in BFS and DFS. Also try to understand a few very important concepts such as detecting number of connected components in a graph,bipartite matching etc. Then you should also learn shortest path algorithms(Djikstra, Floyd Warshall) which are nothing but extensions of BFS and DFS.

7. Learn dynamic programming(DP). The scope of dynamic programming is huge. Try learning both iterative and recursive dp. Recursive dp is easy to code and understand but iterative dp helps you understand the basics more clearly.In almost each contest in Bangladesh, you will find at least 2/3 problems related to dynamic programming. So your base must be very strong. The Lightoj DP section is very good. It contains 100+ problems. At least try to solve 30-40 of them. That will make your basic strong. However the context of Dp is too huge. So it is hard to guarantee that you can solve a DP problem even after practicing for 1 year.

8. While learning dynamic programming, start learning some important data structures. The most important ones are- Segment Tree, Binary Indexed Tree, Trie, Disjoint Set Union(DSU), Matrix Exponentiation(Not related to data structures though, mainly MAth related). Segment tree is also a very very popular thing in Bangladeshi Contests. In most contests, you will find 1-2 problems related to this.

9. Learn some basic string search algorithms. They are- KMP algorithm, Z algorithm, Rabin Karp algorithm etc. At the same time, extend your knowledge in graph theory. Learn basic graph algorithms. Some important one’s are- Topological Sort, Cycle Finding Algorithm, Strongly Connected Component, Articulation Point, Bridge Detection Algorithm, K-SAT Algorithm. These are some high level topics of graph and will help you to solve tough problems.

10. By now, you are pretty good to go. I don’t think that you would need any more guidance if you have completed the above 9 steps. One important thing to mention is that, as you are improving your skills. Don’t only limit yourself to contests in Codeforces only. Contests in CodeChef are very good and standard for those who are in the average and advanced level. Also, never ever try to miss any contest in any Bangladeshi Platform such as(Toph, CodeMarshal, Devskill, Lightoj). If you can carry on in this way, I can assure you that you will be among the best 20-30 coders in Bangladesh in no time at all.

11. Finally, if you have any sort of questions or confusions, Please ask in the comment section. If you need any good resources for learning a topic, also mention in the comment section. This is better than asking in inbox because it will help others a lot also.

Conclusion-
There is no shortcut way of being good in anything. You must be patient, passionate and very devoted. I can assure you taht if you remain devoted, you will be among the best. And being the best in the country will make your life and career much more secured, strong and successful without any doubt.

[collected] from @sadman majid. from my university programming hub collaboration private group.