Yeah. I like the question.

- You should learn the programming and modules by your own
- If there is a problem solve it perfectly it doesn’t matter how much time it takes.
- Learning part : Sorting algorithms, Data structures, Dynamic programming, Greedy algorithms(All basic part, you don’t need to remember the algorithm just catch the algorithm on the problem specification and can modify and apply)
- Please don’t be hurry in writing and submitting the code, just worry about the understanding the problem properly, analyse it step by step and then write your own algorithm as you understand and implement on the paper.
- Finally, Code the algorithm step by step as you want.
- Happy coding

There is no short cut. And there is only one answer : **Practice**.

- Take part in more short contest. They help you improve your speed of thinking. Long competition often have very hard problems that require more research and less thinking.
- Take part in competitions as a team. It helps you see questions from a different point of view.
- Discuss solutions with others after competition. That too helps understand you different solutions.
- Take this course about learning how to learn.

Thanks for A2A, Ashwin Varghese

Unlike many people here I didn’t go too far with it. I had on and off relationship with competitive programming. Let me give a try. First of all, what do you mean by “short time”? I assume a semester – **around 4 to 5 months**. I also assume that you are comfortable with C++ or Java. Otherwise learn it first. You don’t need to learn Object Oriented Programming here. You won’t be dealing with design issues.

Grab “**Competitive Programming – 3” **by Steven and Felix Halim. Otherwise, continue reading….

**What to do?**

- In C++ learn
**Standard Template Library**(STL) which contains the implementation of common data structures and algorithms. In Java, check out**java.math**,**java.util**and**java.util.regex**packages for the same. - Learn mathematical topics like
**Number Theory**,**Graph Theory**,**Probability, Combinatorics, basic Geometry, Game theory,**different proof methods etc. Later you might also have to learn**Order Theory**and little**Abstract Algebra.** - Solve
**ad-hoc questions**which require you to come up with your own algorithm instead of using or modifying standard algorithms. Also solve some problems which require mostly math. - Learn
**data structures**– Segment Tree, Fenwick Tree, Treap, Implicit Treap, Suffix Array / Automaton / Tree, Trie for String based problems, techniques on trees like finding Lowest Common Ancestors (LCA), Heavy Light Decomposition (HLD), Centroid Decomposition over the course of 5 months. - Learn
**well-known algorithms**– Fast exponentiation (applicable to matrices too), string searching – KMP or Z algorithm, basic graph theoretic algorithms to find MST, shortest path, solutions to well known problems like Knapsack problem etc. - You hear terms like Dynamic programming (DP), greedy, Divide and Conquer, Brute Force etc. They are not algorithms, but problem solving paradigms. Know the difference.
*If you are scared of DP, then you are not alone.*

The list of topics is not exhaustive. Have a look at these resources

- Data Science Tutorials – TopCoder tutorials
- MAXimal :: algo . It is in Russian. Use Google Translate. Some articles have been translated to English too – Main Page – E-Maxx Algorithms
- Data Structures and Algorithms
- Awesome resource for DS and Algorithms
- What are the “must known” algorithms for online programming contests?
- GeeksforGeeks | A computer science portal for geeks
- Mathematics for Computer Science – MIT OCW – For discrete mathematics.

**How to do?**

There are many good answers here. I’ll tell what I did. I started solving from most solved problems in SPOJ. I solved about 200+ most solved problems there. It taught me a lot of topics I mentioned earlier. Meanwhile, I used to ** participate in contests** in Codechef, Codeforces and Hackerrank semi-regularly (do it regularly).

**of the problems you haven’t solved during contest. If there is something new, learn and implement the idea on your own. Don’t give up until you get AC. (It is sometimes called ‘upsolving’). Then I solved problems from C and D ladder (in Codeforces) in A2OJ site.**

*Check out the editorial*** Here is a a story** – I took around two months to solve

**QTREE**in SPOJ. I got plenty of WAs, rewrote the code thrice because it was very hard to find the bug. That was the first time I implemented Heavy light decomposition.

**Tips**

- It is okay to get frustrated because some topics are hard to learn and/or implement. It is okay to get Wrong Answer.
- Don’t compare yourself with “red coders” (top rated people) in the beginning. Remember that they have been doing it for years. It only leads to disappointment. They can be your inspiration though.
- Solve LOT of problems. Push yourself outside your comfort zone.
- Lot of practice is needed. That way, you learn to think and implement solutions pretty quickly over time.

Happy coding 🙂

**Edit: **Added resource for discrete mathematics. (Point 7 in resources section).

Thanks for A2A,

I will try to answer this question. Imagine for next 6 months.

**Stage 1: Setting up the base.(2 months)**

Try solving first 200 problems in Sphere Online Judge (SPOJ) . for the first 2 months , try to do all the problems on your own. Stick with this for first 2 months till you gain confidence.

**Stage 2: Moving to Code Chef(2 months)**

Once you gain some confidence on SPOJ problems, move on to codechef and practice for next 2 months.

**Stage 3: Moving to Top coder (2 months)**

Now move to top coder and try competing in SRMs.

Practice daily , try solving 2 or 3 problems on your own. It might take an hour or 5 hours but do it on your own . Trust me after 2 months you will have a very good confidence in problem solving .

This is a sport , the more you train yourself the better you are. Hope this helps.

But if you want to prepare for cracking interviews then it will be better if you go for geekforgeeks and implement each and every algorithm out there in your own console and also keep a check to Wikipedia for learning new algorithms .

You should try by developing logic. Solving problems in computing requires logical thinking and you need to improve that. Having a strong logic is very very helpful in programming competition, for instance, someone makes a program which runs in 10s, possibly you could make it run in less than 5s, and to do so, you need logic. Logic is the basic block of your program.

Having only a good logic won’t help. What would you do with an amazing logical way to tackle a problem if you don’t even understand the syntax? I guess you got what I mean. With great logic, one should know the language very nicely. You should know the insides and out of the language. You should be familiar with the language you’re about to code with and you should be able to understand each and everything written in the code. You can possibly have an amazing logic but the way you impelement that logic is more important. Being able to implement a task efficiently and smartly is the goal to a programming competition and once you have a good understanding of the language and an amazing logic, you can achieve the first prize.

*By using those algorithms extensively on your own.*

I’ve only recently gotten into competitive programming. However, my experience adopting the competitive programming logic and speed has been similar to the learning process behind non-competitive concepts.

Pull up that IDE, relax (you’re not being timed, don’t worry), and build something that makes use of that algorithm. The key to success is to understand how to use it and when to use it. Keep practicing with it on your own until you’re at a point of comfortability where you can pull it out of your inventory on short notice.

Don’t rush it either — it’ll take some time to get to the point where you can easily implement it in a competitive atmosphere.

For most questions of these type the answer is doing deliberate practice. Absorbing practice. A kind of practice which is termed as being in “Flow”

Solving puzzles will help and do will reading good literature because I would prefer building a holistic mind.

Reading this book How to solve it A New Aspect of Mathematical Method:Amazon:Books will definitely help.

Solving puzzles on About – Project Euler will help.

Thinking about hard problems will also help. Your struggle to live with a complex problem and your inability to solve that problem and take that problem to your dreams will help too. Brooding over a complex problem will help too and so will taking help from your sub conscious mind will help too.

Playing a sport or doing some calisthenics will help too. Ideas is to send more oxygen to your brain.

Most importantly you will fail so many times that the motto Patience. Persistence. Perseverance will definitely help.

I can answer you from the other end. How to improve in competitive programming very very slowly? I have an answer to that question.

**You have to train on your own.**

There is not a single person in this field who progressed *fast *alone. So, to answer your question we should just invert my previous advice:

**You have to find a mentor.**

Without mentor you will be progressing very slowly. No amount of practice and problem solving will replace a good trainer, who can see what is your current bottleneck and make you focus on that particular issue.

I was looking for a mentor for a few years already and could not find one, because I am too old (as they think). But you have time as an advantage and you should use it with the utmost care. The best step you could make at this stage towards your progress is to start actively looking for a mentor.

All of us like shortcuts don’t we, but the truth is that there is no shortcut. To get good at anything you need to spend time and train hard. Constant and deliberate practice makes you perfect or different from the average crowd in any field. The same principle applies here.

Keep solving problems, manage time wisely, work smart and don’t look back 🙂

Godspeed!

**It’s not easy but not very tough if you are determined—**

1.>>>Takeup any program you want to write ..( can be any simple or complex program).

2.>>>Code it down on the comp.

3.>>>**RUN IT !**

4.>>>Now get back to the code you have written and check wether you can shorten down the length by bringing in more logical functions .

5.>>>Shorten the length of the code as much as you can .. (Now that will be the perfect code for that prgm).

**————THIS is how you improve your algol thinking .————**

The time i.e short or long time totally depends on you

Practice a lot .

Good Luck !

You have to pratice a lot. There are lots of algos you have to learn them then there are tons of variations of standard algos you have to practice them. Now it boils down to how much you can pracatice and how fast you can do it that is how many questions in how much time you can practice.

Practice is the one mantra which can guarantee your success in competitive coding world.

All the best..!!

Yeah. I like the question.

- You should learn the programming and modules by your own
- If there is a problem solve it perfectly it doesn’t matter how much time it takes.
- Learning part : Sorting algorithms, Data structures, Dynamic programming, Greedy algorithms(All basic part, you don’t need to remember the algorithm just catch the algorithm on the problem specification and can modify and apply)
- Please don’t be hurry in writing and submitting the code, just worry about the understanding the problem properly, analyse it step by step and then write your own algorithm as you understand and implement on the paper.
- Finally, Code the algorithm step by step as you want.
- Happy coding