How to understand/learn algorithms?

I’m very confused. I really don’t know where to start from.
People are saying “Learn Algorithms”, “Practice” and stuff. But, the problem is that I’m new to competitive programming and I don’t really understand what algorithms are. What will I practice, then?
Is there a faster way to learn? At least, just the basics. The problem is that I have very less time(just 4 days) for a contest(codechef based private contest).
Anyway, can you provide relevant information(or, a link to it)?

I don’t know if this is important or no: But, the language I want to code in is C++. I’m not basically a novice in it, in fact I know it sufficiently enough. Just the problem is I don’t know much about algorithms.

1 Like

Unfortunately you can’t learn much about algorithms in just 4 days. The best thing you can do right now is learn about STL. It has many data structures and algorithms already implemented.


Competitive programming is like a sport. There is never a shortcut. There is nothing of the sorts where u have a wishlist of algorithms that u can master in merely 3-4 days. In so less time u can just practice random stuff or any specific weak area that you might have. Apart from that i’m sorry to say there is nothing much to help you out. It doesn’t matter even if you are an expert in C or C++. At the end of the day what matters is the logic that you come up with.

1 Like

if you want you can have a look here it’s brilliant for starting off.It will surely take time to get a grip of it but the rewards are breath-taking :slight_smile:


Thanks for the help. I’ll surely look into learning what it is.

Okay… Thanks for the help.

First of all don’t hurry in becoming good at it. It would be a big mistake. I made the same mistake two years ago, got frustrated and left it. Now i started all over again(bcoz i started missing it & can’t be without it), right from basics(DS: LL,Trees,Graph) & will slowly move to DP & Algos.

Try solving easy ones. Try for 2-3 hours, if not then discuss/see tutorial/solutions. Keep practicing easy ones then move to medium levels. Read editorials,try your self then read code of others as much as u can(but after you have given a decent try). Slowly you will start becoming good at it. It may take time but depends on how much involvement is there from your side. And Meditate regularly! Improves focus & intuition, which improves logic/maths.

For inspiration, there are many but best i know is :


try this website
i hope this will be helpfull…


Quite comprehensive. Thanks for the help.

Try this book for algorithm -

 Introduction of Algorithm - Thomas H. Cormen 


1 Like

Its hard to read a book at this stage.
Anyway, Thanks for Answering.

This one was really helpful! Thanks.

I’ll try learning whatever I can, and just focus on getting a feel of the competition.

bt still in case you want to follow this book you can refer to this blog

and one most important thing as u have time constraint jst be active on codechef you will learn lot of things which one can not do in a month… best people are here to help and a lot of study material is available… im jst following it and yes im lovin it…
happy coding…

1 Like

Okay, I’ll be active.
Thanks, and Same to You. :slight_smile:

1 Like