How I mastered Algorithms in 1 year?
Hello everyone, I was an average coder and weak in Algorithmic Problems in 2020. I was one of those students who said "Writing code on whiteboard to invert Binary Tree does not test real skills". Just by following a strict routine, I mastered Algorithms and Data Structure in 1 year and have started getting positive results (Full time Job offer at Google).
If I can do it, you can do it too. You just need 1 year at max.
Table of content:
- A bit about myself
- My routine to master Algorithms
- Improvements after 1 year
A bit about myself
I am a forth year B. Tech Computer Science student at National Institute of Technology, Silchar (NIT Silchar).
NIT Silchar is a decent University in India and ranks 800 to 1000 globally. For the first 2.5 years at University, I followed the classes and coursework religiously and achieve a CGPA of 8.2. Till then, I was ranked 14th in my class of 52. In my third year Internship interviews, I had just started my preparation and did not get offers from big companies. I went with OpenGenus Internship as it was remote and allowed me to build my Algorithmic skills.
My CGPA fell to 6.8 but my knowledge has paid off. You will see by the results I have achieved (mentioned at the end).
You can say I was struggling but as the saying says just one correct decision can change your life. Skipping an onsite Internship and joining OpenGenus was the correct path.
My advice: Do not get demotivated.
Today, I will graduate in 2 months and have full-time job offers from leading companies. See the section "Improvements after 1 year".
My routine to master Algorithms
I kept the first 2 months to build my fundamentals and practice implementation skills. I could implement by consulting the web but it is not ideal for Interviews.
For first 2 months, I read and understood the following:
- Basic Data Structures (with all operations): Array, Linked List, Stack, Queue, Hash Map, Binary Tree
- Basic Sorting Algorithms: Quick Sort, Merge Sort, Selection Sort, Insertion Sort, Bubble Sort
- Basic Algorithms and problems: Binary Search, Interpolation Search, PICK algorithm, Find number of unique elements, Remove duplicate elements.
With the basics under my belt, I can easily get 100% in a standard University test but I needed to go further. For the next 2 months (months 3 and 4), I worked on following domains:
- Basic Dynamic Programming problems
- Greedy Algorithms (Basic to Advanced)
- Basics of Graph Algorithms
From Month 5, I started particiting problems on CodeForces and CodeChef. I kept the goal of solving 1 problems daily and continued this till the end of 12 months.
On Month 7 and 8, I dived into Advanced problems including:
- Advanced Dynamic Programming problems (solved at least 20)
- Basics of Number Theory (I know at least 50 theorems)
- Intermediate Data Structures: Dynamic Array, Trie, B Tree, AVL Tree
- Shortest path algorithms
On Month 9 to 10, I focused on Advanced topics and practicing problems:
- Advanced Graph and Mathematical Problems
- Advanced Data Structures: X Fast trie, Splay Tree, Bloom Filter
On Month 11 and 12, I focused on revising the concepts I learnt in the last 10 months and kept particing new problems.
Note: Everytime I solved a problem or learnt a new idea, I made a short note in a thick notebook. I had 120 pages of short notes by the end. The notes help me revise the entire knowledge in 2 days.
I never participated in online coding contests or hackathons. It will waste your time so do not go for it.
I have done the following in 12 months:
- Solved 200+ problems based on Algorithms and Data Structure.
- Participated in 0 online contests and in 3 onsite contests (2 in ICPC and 1 in College level)
- Learnt 100+ Algorithms and Data Structures
- Prepared 90 pages notes
- Reduced my 100% attendance to 70% which is bare minimum. CGPA reduced from 8.2 to 6.8. Time is important.
- Confident that I can solve any easy and moderate problem in an instant along with most of the Advanced problems.
I recommend only 2 books:
- Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein.
- Binary Tree Problems: Must for Interviews and Competitive Coding by Aditya Chatterjee, Ue Kiao and Srishti Guleria.
I read 3 other books but my time was wasted in those book so choose the right books as you have limited time.
Improvements after 1 year
I have two full-time job offers from:
- SDE 2 at Google, Hyderabad
- Software Developer (Optimization) at Tata Motors, India
I got off-campus Interview opportunity at Microsoft, Amazon and Uber.
Only top students crack these job offers and you know I came to this point only due to my 1 year preparation. I would like to thank Rakesh, my senior who hos motivation that I can do it and OpenGenus for the guidance and opportunity to prove my skills. Sadly Rakesh had to join an average company but I made it. Yes, I will refer Rakesh in future :)
Apart from this, I achieved the following in Competitive Coding:
- Selected in Amritapuri site at ICPC
- Ranked 3 in Inter-college Coding Contest in my 4th year (previously, ranked 72 and 96 in 3rd and 2nd year respectively). This is a big achievement for me.
- Improved Global Rank on CodeChef from 14,000 to around 1100.
I loved writing my 1 year experience at OpenGenus. Hopefully, you will follow it and get closer to your dreams as well. Best of luck for your career.