Monday 25 June 2018

Competitive Programming - The path you always hesitated to take

You can follow this https://iamruturaj.blogspot.com/2020/05/interview-preparation-guide-must-do.html for better guide towards interview oriented competitve programming. 

Do read this post as a reference.

Just like you all, i feared every time i heard the name "COMPETITIVE PROGRAMMING". During my B.Tech 1st year i struggled even to write a program to print patterns on the screen. Pointers in C programming were the worst nightmares for me..HAHA !!!...

Then in 3rd semester, C++ came into picture. It was the same old story as C Programming with added terrors like copy constructors, friend function, templates etc etc.....

Finally in 4th semester, JAVA the saviour came into my life. No more pointers, No more syntax's to mug up, No more memory allocation (calloc, malloc, freealloc)....

SO HERE COMES THE FIRST THING. YOU NEED TO CHOOSE A LANGUAGE FIRST THAT COMFORTS YOU THE MOST.

If you are good in C or C++ or Python or Java then just go for it. If you are not sure and a beginner then i would recommend you to go for JAVA or Python. Programming in C will make your life to hell in competitive programming. So i won't suggest it because there are no well build libraries in C. 

Here i am mentioning few good resources but you can google for more also,

Programming in C:-
https://www.amazon.in/Programming-C-Reema-Thareja/dp/0198070047
http://www.dipmat.univpm.it/~demeio/public/the_c_programming_language_2.pdf
https://www.javatpoint.com/c-programming-language-tutorial

Programming in C++:-

JAVA:

Python:

DO NOT LEARN EVERYTHING AT FIRST. JUST THE FOLLOWING THINGS YOU SHOULD LEARN. 

1. Basic input and output syntax (print statements and taking input from user)
2. looping constructs (for, while, do while)
3. If-Else conditionals
4. List (Stack, queues, deques)
5. Map
6. Recursion and function calls
7. Constructors and class definition
8. Math Library Functions
9. Sorting and Searching (inbuilt functions)
10. Some shortcuts ( you will develop this gradually by yourself)

IT WOULD TAKE 10 TO 25 DAYS TO LEARN A LANGUAGE PROPERLY DEPENDING UPON INDIVIDUALS GRASPING POWERS.

NOW LET'S TAKE A STEP INSIDE THE WORLD OF COMPETITiVE PROGRAMMING,

Fix this in your mind that it is a very slow process to be a competitive programmer. It took be 11 months to reach a standard level of competitive programmer. So you might take even more depending on your grasping and understanding power. 8 to 12 months would be the general range though. There might be days in which you are stuck in solving a simple problem. No worries !!! Just keep going...Don't give up midway...

IMPORTANT RULE: 
If you are ever stuck in a single problem for a long period of time. Just leave it. Take a break. Do some other problems or relax. After a while you would find the logic...

Now question is from where should you start !!!!

LEARNING DATA STRUCTURES IS THE FIRST MOST IMPORTANT THING.

Data structures are the foundation pillars of competitive programming. Don't jump direct into algorithms.

Master the following data structures first:-
1. Array
2. Stacks
3. Queues
4. Heaps (Max and Min heap), Priority Queue
5. HashMap or Dictionaries(in Python)
6. Graph implementation basics (BFS and DFS)
7. Disjoint Sets
8. Segment Tree / Fenwick Tree
  
Mastering means you should read the concepts first, see how it is implemented and then solve 5 problems on that topic without looking at the solution.


Just go through the topics i have mentioned above. Leave the rest that are present in the website.

NOW IN THE NEXT STEP YOU ARE SUPPOSED TO INTRODUCE YOURSELF TO FEW SIMPLE ALGORTIHMS:-

1. Binary Search
2. Merge Sort
3. Prims or Krushkal, any one 
4. Djikstra (the night-mare, haha!!!)
5. BFS and DFS
6. REGEX matching

Just learn how they work first. Many programmers forget how to implement very often. But if you remember how they work. Slowly you can write them on your own. But a beginner just learn how they operate. You can always copy code from google initially.


Now after you have done this. TIME FOR THE LAST STEP. 
THAT'S PRACTICE.


Complete the above series religiously. You will learn everything gradually. Solve 5-6 problems from each topic and move to next topic. 

THEN COMES THE CHALLENGING PART. NOW YOU NEED TO EXPLORE REAL WORLD CODING QUESTIONS AND EXPERIENCE.


Solve all the problems in the above link. 

After this no one can stop you !!!.... 

If you have reached till this point then you have already reached a standard level

These are few contests that i have hosted at hacker-rank in past. Do solve them. Editorials are also there. You will learn how "Hackerrank" differs from "codechef". Every platform has it's own set of interface. But if your foundation is strong then you will survive in any platform.

Links:-

AFTER THIS, YOU ARE THE KING OF YOUR REGION. JUST EXPLORE THE WORLD...

Challenging problems can be found out at:-

(Do check how to submit in codeforces first. it's bit different than other platforms. google it !!!)







WORLD FAMOUS CONTESTS THAT YOU CAN TAKE PART IN AND AVAIL CASH PRIZES AND JOB OFFERS ( Just google about them)

1. GOOGLE CODE JAM
2. FACEBOOK HACKER CUP
3. ACM ICPC 
4. CODENATION HACKERRANK
5. CODECHEF SNACK DOWN
6. CSI, COMPUTER SOCIETY OF INDIA PROGRAMMING CONTEST
7. TCS CODEVITTA

POPULAR INTERVIEW QUESTIONS OF COMPANIES CAN BE FOUND OUT AT:

https://iamruturaj.blogspot.com/2020/05/interview-preparation-guide-must-do.html


REFERENCE BOOK FOR COMPETITIVE PROGRAMMING:-


FOLLOW ME ON:



JUST GO OUT THERE AND EXPLORE ALL THE POSSIBILITIES. DON'T LEAVE MIDWAY !!! YOU ARE ALMOST THERE ...

GOOD LUCK...







12 comments:

  1. I want to read in programing
    Mob-8709717611

    ReplyDelete
  2. Bhaiya does it require to be a competitive programmer at m.tech level. I am not good at coding and preparing for gate.Should i focus on competitive programming now ?Does it play role in M.tech?

    ReplyDelete
    Replies
    1. Yes mtech is full of coding wherever you go. All assignments require hard coded codings. It would be really difficult to survive here without coding.

      Delete
  3. sir, in that that code monk link of hacker earth one cant go to next level if one haven't solved atleast 4 of 5 problems, its tough, please help, also in the code chef link do i start at beginner level or from medium.

    ReplyDelete
    Replies
    1. https://iamruturaj.blogspot.com/2020/05/interview-preparation-guide-must-do.html

      You better follow this post. Previously it was open now they have changed the settings.

      Delete
  4. Sir python sai competitive coding krne pr iit mai package difference or companies reject toh nhi krte

    ReplyDelete
    Replies
    1. Python along with java or c++ is required. Some companies dont allow python. 90% companies allow. So my suggestion would be to learn java along with python.

      Delete
  5. Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles Python Programming Training

    ReplyDelete