Data Structures And Algorithms

Introduction

Hey Folks..! In this blog, I'm gonna share my experience of how I mastered Data Structures and Algorithms in just 2 months plus how I solved 100+ Leetcode problems during the learning period itself. The reason for writing this blog is that most of the guys felt that DSA is hard and is require tons of time to complete it. Everything is hard until we learn and practice it. This Blog will split into 3 segments where first segment focus on my experience of how I learned and practiced DSA effectively. The Second Segment focuses on What to do.? To master DSA in a short period of time. the Third segment focus on How to do.? How to master DSA and solve problems effectively. Well, It's time for knowledge, let's continue.

DSA Experience

Well, Myself Senthil Athiban, a non-CS Student. Currently purchasing Engineering in Mech Stream. The reason why I choose to master DSA is simple, that everyone knows to begin with coding, we must learn a new programming language and its basics concepts. Learning a new programming language is not enough, we can able to get it only when we are solving real-world problems and understanding the problem scenario. To Begin coding, choosing the programming language is important. Most the folks like to learn DSA in Python, the reason why is python is easy. I agree with that point, But we should understand that language doesn't matter for DSA. We can master DSA in any language ( C++, Java, Python, JS ). But the thing is when we are going to start to learn a new programming language from scratch itself, we should aware of whether the chosen language will helpful for us in our future careers. Learning DSA in Python is good, it will be helpful only when we are going to pursue our career in data science / ML / AI. If we are going to pursue our career in the field of Web development, then recommended one is java or javascript. Of course, we can do web development in python using Django. But the most recommended and currently in usage are java and javascript majority. So, Learn a programming language based on your career path and master it. This stuff will surely be helpful in your career path. After learning one programming language, then it is easy to learn another programming language. Taking initiative is important and choosing the correct one will create an opportunity in our career path. I chose Java to master DSA. Even though I learned python in schooling itself, I chose Java because I know my future career path needs java where my area of interest is Web development. Then, I started to learn Java and DSA in the same language on October 31, 2022. During the time of learning, initially, it was easy to understand the basic concepts like condition statements, loops, operators, 1D Array, and String concepts. When I get into some next-level concepts like 2D Array, StringBuilder, and Memory management for data structures. It takes some time to understand and to move on. Daily, I spent only 3-4 hrs on DSA and sometimes I don't have time for DSA because I had my Academic Schedule also. So, I had to manage both the college work and the DSA bootcamp also. I usually forgot new concepts after learning for 3-4 days. The reason is as I had a college project works, and other stuff also, so I can't focus on DSA consistently. After a lot of work, I got some time to get back into DSA, the date is on Nov 16, 2022. Initially, I started Algorithms like searching and sorting algorithms. The Theory and code part is easy only. But When we are getting into solving real-world problems, is a challenge. I used Leetcode to solve problems, initially, I solved only one problem and spent a whole day on it. The tragedy is that I can able to do code in python only, but cannot to able to code in java. Then spent time on basic coding problems in java like palindrome, patterns, and arithmetic operations. I read the documentation on java and its in-built functions. Then, I solved my first problem in leetcode using java, that was a great moment for me. After learning those algorithms, I cannot able to approach the problems based on searching and sorting algorithms. After, I watched many videos on how to solve and approach a problem. Yeah, It took much time to learn and to move on. Then, I solved 10+ problems within 6 days, and moving on I solved 20+ problems in the first two weeks. After that, I had exams as well as lab work also. Thereby I started my DSA journey after 1 week which was on Dec 2, 2022. Then, I learned Math, Time Complexity, Space Complexity, and Bitwise manipulation. Those topics are a little hard to understand initially, it took some days to understand. After that, I solved some problems based on arrays and bitwise manipulation problems. I reached 40 problems in the mid of December. Yeah, Coding takes some time, for me, it took 2 hrs for a problem initially, thereby it was reduced to 1 hr and to 50mins. This time management is not based only on the coding part. How to solve a problem.? will discuss in our third segment part. After completing 50+ problems, I got an idea of how to approach and solve a problem. From December last week to Jan 1st week is my end-semester examination, so I didn't have time to continue my DSA learning. But my coding part is not stopped, and it continued consistently. On completion of Examinations, I started my DSA journey without any rest on Jan 7, 2023. I Begin to learn Data Structures like Linked lists, stacks and queues, Trees, and in addition to recursion+backtracking also. It was so hard initially to understand those concepts initially and to code them. I referred to so many resources and practiced. I took only 14 days to complete Data Structures, OOPs as well as DP concepts, learned in January month. Those 14 days are literally hard, as I had spent my whole day on coding and theory parts for algorithms as well as for documentation. In addition, I coded data structure problems and get practiced. I reached 100 problems exactly in January mid. It was a boost-up moment, I solved 30+ problems in those 14 days on my daily learning concepts. Those times are hard, but keeping ourselves learning and practicing consistently is literally important for us to move on to the next step. In upcoming segments, will share my tips and strategy for what to do to master DSA and how to code it effectively not like me, but better than me.

What to do?

The first point is choosing the programming language. This is the stage where most people got stuck. As I mentioned above, choose the language based on your career path else based on difficulty. My suggestion is to learn Java. The second point is to create a roadmap and set a deadline for it. If you are learning a new language means, then start from scratch, and complete it with Data Structures. The third point is choosing the resources to learn. Reading the documentation, and watching videos are good ways to learn DSA effectively. There are so many resources available online freely for DSA, especially on youtube. If you are ready with the resources, and your compiler, then it's time for coding. If you are an intermediate programmer, then skip this point, Step four is to try to code basic problems initially in your new language. Do some basic coding initially like CGPA calculation, Calculator, getting input from the user, doing some arithmetic, and then printing it. Then like a palindrome, Fibonacci, prime numbers, duplicate numbers in an array, reversing the elements in an array, and reversing the string. The fifth step is to try to solve problems on a particular data structure or concept in leetcode. If you are learning the array concept initially, then try to solve array problems in leetcode. If you are learning string concepts mean, get to the string section in leetcode and try to solve it. If you are not aware of what is leetcode means, leetcode is coding practice platform, and you will get questions like the most asked questions in Top product-based companies like FAANGM. To crack FAANGM companies, leetcode is enough to practice. The sixth step is practicing coding consistently, this is an important one. Try to code at least one problem in leetcode. If you are following the above steps, then it is good, let's move on to the next step. Step seven is trying to solve the problems efficiently, which means optimizing the time complexity and space complexity. If you are not aware of what is time complexity and space complexity, then stop your learning process, because without knowing the time complexity and space complexity of a problem, coding is useless. As I mentioned earlier, set your roadmap properly, and start your DSA journey. Those concepts are important in order to learn upcoming concepts. So, make your roadmap correctly and start your journey. Try to learn about time complexity and space complexity and get back to the coding platform. Now, it's time to continue our journey, and optimize your code, if you don't know how to optimize it, then check out online documentation and youtube videos, where you will find a better solution of it. Step Eight is to try to make notes on learning, and the way you are solving the problems. These things might help you in the future when you forgot about some concepts and how you solved the problem. Those Things will surely help you to recollect the points of your DSA journey. Step Nine is don't close this blog and get back to the homepage when you are bored :) Just for fun. Here is Step nine, try to maintain your DSA journey consistently both learning and practicing part. If you skip your learning say for 6-7 days, then it is a little hard to get back your code and recollect it. The reason for consistency, say if you are solving two problems in a day, skipping the next day to code and starting again on the day after is wrong. If you are solving the problems daily means, you can hold your state of mind in your coding journey, otherwise, you may get distracted and then it is a little hard to get back into the same journey with the same effective mode. Skipping one or two days is negligible, but try to avoid skipping your practice or learning. Our goal is to complete it within the deadline. So, Don't pass your day without coding, and don't pass your time with learning. Is it possible to complete the DSA within the journey..?. Yes, it is highly possible, initially, it may take some time to learn some concepts and to code them. If you spend much more time on a single concept and then try to learn it in other some easy resource else try to learn from your friends if anyone knows DSA already. Try to allocate some time if you are lagged in a concept and took a long time. Compensate the planning, manage the time, and follow your deadline without any excuses. Say if you don't have much more time on weekdays, then utilize your weekend for it to learn and code it. Don't give excuses for your deadline, is the final step.

How to do?

Hey, How can I master DSA within 2-3 months? How can I code 50 problems in the first 30 days of my journey? How can I master all algorithms within the deadline? What should to do to code consistently? How can I manage my time? How can I code without getting bored? Here is the answer to all these questions. Well, As I mentioned above in step three, choosing good resources to learn DSA. This is the starting point and crucial one for all. If you are able to read the documentation and can able to understand it means, fine, do it. If you need a tutor, good content, and an important one to learn free of cost means, then your platform is youtube. Youtube is the university for students to learn effectively free of cost. I watched kunal kushwaha youtube channel to learn about DSA. Yeah, the man who teaches a single concept in-depth, and his way of teaching is for those who are all studying schooling :), means even a child can able to understand what is recursion when the child watches kunal kushawaha recursion lecture. How cool is that :). He is trying to induce our brainstorms and activate them to code. So, following good resources will lead your career path to success. So, try to choose good resources to learn, not for DSA only. When you are learning anything new, and want to explore it means, getting ideas from the mentors is best. So, if you want to learn effectively, then choose the correct resource. My suggestion is youtube, Coursera, and online documentation. In youtube check out kunal kushwaha, Neso Academy, freecodecamp, etc. For Online documentation GeeksForGeeks, JavaPoint, and W3Schools. Try to explore yourself, when you are learning and understand the problem from many perspectives. Don't rely on a single resource. Then it's time for the coding part, if you want to implement the learning, and code what you have learned, as I mentioned Leetcode is the best platform to practice. Go to leetcode, then select the tag to your preferred topics and set the difficulty level to easy initially, then move on to medium-level questions. Start to solve the problems, if u got stuck, check out the hint section and discussion section. If u solved a problem but got unexpected output means, copy the code to your local compiler, debug it, and identify the part where your code got mistaken, then rectify it. If you are not able to understand the problem concept, go to youtube and watch out for the problem description part only, if you got the problem means, come back to leetcode, and take pen and paper, try to solve it on your own. If you could not get the desired output or are not able to solve it. Then it is time to check out the solution. If you are going to solve a problem, take one hour to solve it initially, if you are not able to solve it after one-hour means, then check out the answer for it. Don't spend much more time on a single problem and get stressed. It is not necessary for everyone to know all problems. Sometimes, it is hard to get it initially, but it is not meant to fail. Failing occurs, when you are not trying out the problem on your own. So, try to understand the problem first, then check out the sample cases, then do it in pen and paper, and at last code it. If you are not able to get the problem, move onto youtube and search for solution videos. If you are able to follow the prescribed steps, then you can able to crack any interview. My suggestion is don't follow any specified DSA sheet and specified topics. Try to solve problems on all topics at least 20+ problems in each topic, then only you can able to get an idea of it. Yes, that's all about DSA. If you want to be good at code, good in DSA, good at problem-solving, and good at logical thinking, then engage yourself in learning, don't get distracted, don't get scammed, don't pass your day without coding, don't pass your life without achievements, don't get triggered when someone laughs at you, show them what you can and who you are. Yup.! if you enjoyed this blog, and got the idea means, share it with your friends and with someone who is learning DSA. Share your thoughts in the comment section. In the future, I'll share what are all the algorithms, and how to master them in an easy way, and will categorize the algorithms based on topics and will share them with you all. Learn from public and share it in public. :)

  1. https://youtu.be/RBSGKlAvoiM

  2. https://youtu.be/8hly31xKli0