What is the best approach to improve competitive programming?
Competitive Programming
Competitive Programming is a sport, I mean literally. Take any sport, let’s consider cricket for that matter, you walk in to bat for the first time. Swing and a miss, do it couple of times and you’ll eventually hit one over the ropes. Now, consider a programming contest as a game of cricket, metaphorically. Compile a code and submit, you may get a WA (Wrong Answer). Make changes to code and eventually you will get your first AC (Accepted/Correct Answer). Let me give you a sneak peek, about 20% of questions in a programming contest are simple conversion of plain english to a code of your favourite programming language.
Walk right into it, you will learn the unwritten rules of the game as you play harder and get better. And believe me, you don’t need to know any “fancy name” algorithm or data-structure to get started. Ever heard of “Waft shot”, yet you’re the best batsman in your street, right?
Levels of our Journey
A walk in the Park: Level 0
Alright, let’s conquer the first 20% of programming problems out there.
You need to know:
All you have to do is, read input line from STDIN and print reverse of that line to STDOUT. Go ahead, make a submission. Seek your first AC. Want more? We’ve got loads in our practice section. Look for the ones with thousands of correct submissions.
You need to know:
- Intermediate hold on any one programming language
- English! Convert english to code!
All you have to do is, read input line from STDIN and print reverse of that line to STDOUT. Go ahead, make a submission. Seek your first AC. Want more? We’ve got loads in our practice section. Look for the ones with thousands of correct submissions.
Welcome to the Jungle: Level 1
Okay, now you’re ready to take on some real challenge. Hold tight, we are diving deeper.
You need to know:
You need to know:
- Sort and Search algorithms
- Hashing
- Number Theory
- Greedy Technique
More importantly, you have to figure out what, when and where to apply them. It gets really tricky and hence to help beginners gain a feeling of confidence we run a series of contests as Code Monk. Before each contest, we release a tutorial on certain topic and later in the contest the problems are aimed only on that particular topic. I’d recommend you to go through the tutorials and solve a question or two on each topic.
Take the Fast Track: Level 2
By now you’ve realised that the questions are framed to deceive the way we think. Sometimes, If you convert plain english to code, you’d end up with TLE (Time Limit Exceeded) verdict. You need to learn a set of new techniques and algorithms to cope up with the time limits. In certain cases, Dynamic Programming (DP) comes to the rescue. In fact, you might have already intuitively used this technique. There’s always at least one question in any contest that can be solved by DP.
Also, you’d have noticed that there are questions that just can’t solved by linear array data-structures.
Also, you’d have noticed that there are questions that just can’t solved by linear array data-structures.
- Graph Theory
- Disjoint Set Union (Union-find)
- Minimum Spanning Tree
Load up the Weapons: Level 3
You are all set to top the leaderboards of Short Programming Challenges, just keep steady persistence. As I’ve already mentioned, it’s a sport, you won’t master it until you actually do it. Go ahead, participate in a short contest, know your strengths, weaknesses and see how you handle the adrenaline mode when the clock is ticking.
Stick to your own logic as long as possible, you’ll eventually come up with something similar to the algorithm required to solve the question. You just need to brush it up. Several of these techniques will help you solve some of the toughest of the problems around.
Stick to your own logic as long as possible, you’ll eventually come up with something similar to the algorithm required to solve the question. You just need to brush it up. Several of these techniques will help you solve some of the toughest of the problems around.
- Segment Tree
- String Algorithms
- Tries, Suffix Tree, Suffix Array.
Heavy Artillery: Level 4
You’ve already become a pro at this game. If you fail in one, go back and analyze where you went wrong. Read the editorials after the contest. Many programmers underestimate the value of post contest analysis, because you had already figured the whole solution but missed just a single case. So the urge of knowing what you missed is irresistible and you’ll never forget what you learnt in the analysis.
Usually there are not many deep algorithm intensive questions in short contests, however longer version such as monthly clash challenges on HackerEarth may have applications of one of these.
Usually there are not many deep algorithm intensive questions in short contests, however longer version such as monthly clash challenges on HackerEarth may have applications of one of these.
- Heavy Light Decomposition
- Graph Coloring, Network Flow
- Sqrt Decomposition.
#NOTE:-
Many programmers argue that the problems in competitive programming do not relate to the real life programming work. For the most part, it is true. Then why do we do it? Because it makes you a better programmer. How?
- Time limit always makes you write time efficient solutions.
- Critical test data helps you write correct solutions, in one go!
- Further it makes you great at debugging code.
- Hard problems makes you break down the problem into chunks, solve them individually and bring it all together to solve the main problem.
Thanks You!
Don't forget to share and comment...
Don't forget to share and comment...
What is the best approach to improve competitive programming?
Reviewed by Sumit Tech Bhartiya!
on
10:30 PM
Rating:
No comments: