TechoSagar: What is the best strategy to improve my skills in competitive programming in 2-3 months?


What is the best strategy to improve my skills in competitive programming in 2-3 months?




Viktória Nemkin, studies software engineering at Budapest University of Technology and Economics.

This sounds off topic but please bear with me for a moment. What I struggle with a lot is essentially not doing what I know I should and want to be doing. My mind is not focused, I go watch a stupid video on youtube and the whole day is gone. It is really hard for me to get myself going. I don't know you, I don't know if you have the same struggles as I do but maybe some of this advice will help you stay focused if you need it.
Here are a few things I've learnt about doing competitive stuff:
  • You don't have to and you really shouldn't overwhelm yourself on the first time. Don't go to the bookstore and buy the heaviest, biggest book on Computer Science only to read the first few pages and realize you don't understand it and give up. I'm guilty of doing this a lot. Instead, try to find something that is not so into detail and easier to wrap your head around it. In the next steps I try to recommend you easy to understand tutorials online.
  • Don't wait to get motivated. I find this advice really good because it is a great insight to how your mind actually works. I'm sure there are a few lucky people to whom this doesn't apply but for the rest of us, we are not going to feel like studying and practicing all the time. There will be days when we will get bored doing it. There will be days when we will want to go do other fun things. What makes successful people different from everybody else is that they can handle the boredom of doing the things they want to be doing for a long time. (I've read this here: How to Stay Focused When You Get Bored Working Toward Your Goals .)
  • Don't try to completely change your schedule and study and practice in all of your free time. Completely changing everything is really hard and can easily overwhelm you and make you give up. Just like trying to get down to a healthy weight by eating 500 calories a day. You just can't stick to it in the long run. Instead, go for small changes, but do them regularly.
  • Don't let other people's success demotivate you. You know how they say no matter how good you are, there is an Asian kid who is better than you? I'm no IOI medalist. I did compete in the country level qualifiers to get out but no success. I see famous people answering questions here on Quora and I'm really not one of them. But really, who cares? Feel proud of what you have accomplished so far and instead of comparing yourself to everybody else, try to outdo yourself. Generally, a lot of hard working famous people are also very humble and they will tell you they had their moments of giving up, failing and feeling bad about themselves. You only see their success but not how they got there.
I hope this advice helps you stay on track. Now to the more technical stuff.
Knowledge in theory of algorithms and data structures
I started practicing for competitive programming with my teacher in school, the first few things we learnt were:
I think that's basically all I knew when I first competed. Probably other people will tell you a lot of other things, this is just how I started out.
Later, you can find a book that works for you and you can read it or watch an online course to get into the topic more deeply.
Here are some examples:
A programming language
I like C++. It is fast, it has its Standard Template Library with plenty of cool stuff. For example if you need a good sorting algorithm you can just include the algorithm library and use one function. It is really useful because you don't want to waste your time on a competition to implement basic things like data structures and basic algorithms.
Some tutorials on STL:
And the reference site I use:
Look up some Containers like vectorliststackqueue and the sortalgorithm I talked about.
Some argue that C/C++ are the only reasonable programming languages for competitive programming. I would say if you don't really like C, go for a high level language. It's better to be comfortable with the platform than to be miserable with C. A lot of good competitors use Java, and they say it is not a drawback for them. Look up similar libraries for your choice of language and try using them!
Practice, practice, practice. A lot.
It's one thing that you know how to solve stuff in theory. It's a completely different thing that you can code it, it compiles and runs, gives no errors, you made sure all variables are big enough so they will fit, it is fast enough and doesn't use too much memory.
You need to go sit down and solve exercises for yourself to be able to do it fast and with no errors on stage. When I'm out of practice I spend 10 minutes debugging a binary search because I just can't write it for the first time. It's not good to spend 10 minutes of your competition writing a binary search.
So doing exercises, not just in theory but finishing them with a tested, working code is really great for you.
Here are a few sites that host online competitions regularly:
What's really great about these sites that you can post your code and they will test and score you for all the previous competitions. Even better, you can see what others have sent in. You can learn a lot from other people's codes. I've heard that some guys on Codeforces spend weeks optimizing their code, so they run faster than anybody else's.
If you check previous competitions on these sites, usually the first few problems in each of them are easy to solve and are aimed for beginners.
I hope this answer helps you get started. :)

Published after taking permission from author .

Thanks  Viktória Nemkin

Follow us

Follow Bijendra Kumar on Facebook