So how do you improve on this?
Mastering these things require two things: understanding and implementation. Here are some steps to follow.
#1 Read about the data structures/algorithms. I have given you a good list of things to study, but this won't get it entirely. Here is another link to find lists of algorithms: What are the algorithms required to solve all problems (using C++) in any competitive coding contest?
- Obviously, this does not cover everything. Reading CLRS algorithm book will also be really nice.
- Algorithms Books: If CLRS is considered quite a hard book for beginners, what’s another great book you would recommend for beginners?
- You will see that reading about algorithms and data structures is kind of like supply and demand. The more problems you do, the more algorithms you've got to study up on.
- Don't need to implement right away. Make sure to understand the details of
the data structures/algorithm, so that if there is a little twist in a problem, you'll be able to pick it up immediately and know where to change your code in your data structure or algorithm. I would recommend writing out the steps on a piece of paper and being the computer and doing each step of the algorithm or each part of the data structure by hand.
#2 Practice, practice, practice. This should be simultaneously done with #1. Never just do #1 or #2; this will not help you. You need to implement AND learn how the algorithm works, so that you are able to tweak it however you want.
- There are so many online coding platforms: What are the various online programming contests?
- Here are the ones I would say to focus on:
- CodeForces (data structures): ability to look at other people's solutions, weekly contests, no shortage of problems, most problems have editorials
- HackerRank (algorithm domain): similar to CodeForces, able to look at other people's solutions, most problems have editorials
- HackerEarth (newly released data structure track): lots of problems, plus editorials (have to unlock)
- Others: USACO Training Pages, USACO past problems, HackerEarth, TopCoder, SPOJ*, CodeChef*, online judges*
- *solutions and editorials are rare in these cases, you will have to google search or ask questions
#3 Implement. Get a working code ready and debug if necessary. You should be able to look at your piece of paper and code up the data structure/algorithm pretty simply. If you get stuck, you might have either misunderstood the algorithm/data structure (Go back to step 1) or consult a pseudocode (either on Codechef or HackerEarth Code Monk or TopCoder tutorials or etc.).
- Some tutorials on data structures which you can learn from.
- Data Science Tutorials (pseudo-code)
- Data Structures and Algorithms (above link)
- Code Monk - Be a better programmer or Notes on HackerEarth (in lots of different languages)
- Studying data structures is about understanding them, not just implementing them. This is because changing data structures to fit a question requires you to understand how it works. Thus, it doesn't really matter which language the data structure is coded in; just try to understand it by doing it by hand.
- Similarly, deal with algorithms the same way. The links are above for practice. Some reference links (maybe help?): Algorithm | Code Accepted
#4 Don't stop even if you get stuck. Get help immediately. Do one or multiple of the following:
- Try find other people's solutions or read the editorial. Get the main idea of the solution. Now CLOSE the solution and implement your without reading the solution again. This is quite important, so that the algorithm/solution will sink into your head. This is why I gave you some websites to use above. They have editorials, which helps a lot.
- All coding problems have patterns. You will always see similar problems all the time. Thus, strategies and algorithms you used will also pass over. Remember keywords that strike an algorithm. This will play a big role in your success as a competitive coder.
#5 Do contests (for fun if you aren't a competitive coder). There is no better practice than actual contests. Contests help with your ability to contain your stress and will test your strengths to the maximum. After each contest, make sure to solve all the questions that you did not solve during the contest. This is a major key.
#6 Have fun. You really can't be good at something if you don't like it. So have fun!
This was a really intense breakdown of algorithms/data structure prep for competitive programming, but the idea for just learning algorithms and data structures still applies. The point is practice, and practice with the right resources. Good luck.

No comments:
Post a Comment