Learning DSA after 4 years of experience

shrey vijayvargiya - Jan 17 - - Dev Community

Why do we even want to learn it in the times of AI

Under the Hood

The most asked question by developers is how to learn DSA

Some of us hate DSA, whenever it comes on the table our first thought is it won’t be that useful.

But DSA is not just solving questions but the ability to think clearly about how data is stored, problems are solved using the data.

I’ve 4 years of software development experience and so far I’ve done any course and proper classes for DSA(Data Structured and Algorithms)

Common questions we had regarding DSA

  • It’s a myth that it is too difficult to understand?
  • How to learn DSA if you are not a computer science student?
  • Where to learn DSA any reference or course?
  • Where does DSA is required and useful?
  • a lot of questions exist regarding DSA, it’s like a black box for me also. Shades of gray, a kind of black box that I as a frontend developer very less likely to touch. But DSA is important because it is asked in all the interviews, right?

Well, not really in all interviews DSA is asked, during my interview experience I was asked Tree, Linkedlist, graph and DP very less than usual javascript methods, time complexity, event loops and other world-related questions.

Why DSA after 4 years?

That is a good question to answer, probably the reason why I am writing this story.

Well, see I want to develop anything in the world from scratch need 2 things the data stored in the database and the ability to fetch/store/update the data.

  • How data is stored in the database
  • How data is updated/deleted/searched/sorted in the database
  • 2 superficial requirements for any application in the world.

Even in the system design interview, we will be asked to design the proper system using the above 2 factors in mind. The entire interview revolves around the above 2 factors, how well we create the database and fetch/update/delete data efficiently.

So my story began when I was working on core products for my website iHateReading.

One JSON to create a code repository

I was using the Node.js express application to create my own dedicated endpoints/server or API. The one among the many endpoints has the feature to take the JSON input and return the zip file to the client that contains the file/folder or entire directory created using the one JSON input.



createCodeRepository = (jsonTree) => {
 Step 1 -  // iterate over the tree 
 Step 2-  // create file is the first node is file and add the content
 Step 3 - // create the folder if the node is folder & repeat the step 2
}


Enter fullscreen mode Exit fullscreen mode

Now this one method looks simple and we are using the recursive function to traverse the tree along with fs the module of Node.js to create a file/folder and finally, the gzip module to create the zip folder for the response.

One can guess the solution by observing the input jsonTree and simply looping over it but recursive and traversing trees becomes easy if you know how to write algorithms using data structures.



Data Structures+ Algorithms = Programming



Enter fullscreen mode Exit fullscreen mode

This is true, if you know data structures well you can simply write good algorithms, a clean and simple code making your programming skills at par.

DSA is just tools that empower you to solve problems easily by using the divide-and-conquer rule.

5 types of highly used DSA

  • Arrays
  • LinkedList
  • Stack & Queues
  • Trees
  • Hash maps
  • Graphs
  • Dynamic Programming Now imagine these are the tools to make your life simple, just like an npm module.

All we need is to understand how and where these tools are used.

To understand that well we need a basic understanding of why these tools are created and then apply them in the problem statement(basically practice)

2 things to remember over here

  • Understand why a type of DSA is created or discovered
  • How to use that type of DSA in programming? It’s like using a toolbox to improve and construct your bike, you have a toolbox that contains a bunch of tools to solve any problem your bike has and before even starting you need the knowledge of why tools exist and how to use them.

Similarly, DSA is the tool to solve problems easily by dividing them into categories helping developers to write clean and optimised programs.

Hence making a developer a good programmer if he/she knows DSA well.

The choice is yours, do you want to feel empowered?
I crave this skill to solve any problem in programming so I have this resolution to learn DSA one day.

The thing that scares me the most is the one I want to try for once at least.

Learn DSA to educate yourself

Being a frontend developer, I love frontend websites, apps, mobile apps, and animations so I don’t need to learn DSA.

Neither it’s about the professional career because we hardly write programs such as sorting using binary search trees etc nor do we think about time and space complexity while writing programs.

But it’s more about having fundamental knowledge, knowing what does under the hood to every application in the world.

For example, Developing a Github application requires good programming knowledge because

  • Storing the entire code repository tree in the database
  • Along with each file content
  • Comparing 2 files at the same time to add version controls
  • Updating the file content in less time and less space, faster execution These all things do need an understanding of DSA otherwise you will just keep on using it for loops, maps, filters and other javascript or your language-related in-built methods.

DSA just gives you power since you know the tools you have in the toolbox you can easily solve the problem and create any application you want instead of using for loops, I would work with one JSON tree just like the DOM tree in the browser and traverse using recursive and store in the repository in the database.

I would leave the rest to you, think and try to answer the following question using first-principle thinking

  • How you can develop github like the application?
  • How you can create a DOM tree like React.js?
  • How does Google put the website on search indexes and rank them accordingly?
  • How do Google Maps show the fastest routes?
  • How do Amazon and Airbnb show recommendations based on similar searches?
  • How blockchain database is created, and how is this decentralised technology even programmed?
  • How VScode understands and reads all the programming languages and beautifies the code into colours, detects the closing brackets and so on. Of course, it’s not easy to answer and solve these questions.

Lary page had failed to create a Google search engine for the first time before 2000 and later one was developed by Sundar Pichai.

Answering these tough questions requires a solid understanding of the tools you have in the toolbox, that is DSA. We have to understand that it’s not important but if you want to feel powerful and the one who can develop anything in the world you do need to know the tools hence learning DSA becomes a must.

Learn DSA not to crack interviews but to educate yourself.

How to learn DSA?

For everything I want to learn, I first create the roadmap plan.

Roadmaps are the clean guidance that Hitler used to conquer the USSR and and whole west of Europe.

That is what roadmaps help to do, you can use my templates or find one on the internet, ask chat GPT for the roadmap to learn DSA or even take the Udemy course.

  • First, get the roadmap for DSA
  • Collect resources to learn DSA
  • Make notes of whatever you are learning
  • Collect questions and answers to practise DSA
  • Practise and practise with real-world problems

If you don’t feel confident in DSA after the course repeat the process from step 3 by recalling your notes and keep practising.

Why I am saying keep practising is because we don’t understand how to solve any problem using loops, trees or linked list and practise along with notes will simply help us to crack the solution easily.

Visualization of Data

This is the one thing I’ve learned from Bret Victor's blog.

Learnable Programming

One trick helped me to become a better programmer.

See it’s not about writing code, before writing code our mind calculates the solution so visualization occurs.

We visualize how data is travelling in the for loops, how data is stored in trees and graphs, how our program is updating the data etc. All these steps are visualized first in our mind before we begin to write code.

Google take interviews on Google Docs, have you ever thought, why?

Senior developers look for the approach rather than jumping to the writing code, why is that?

It’s simply because you need to understand and visualize how data is working in the problem, visualising by either writing on pen-paper or thinking in mind is the key to solving the problem even before writing the code.

Writing code in any language is just another set of tools you are using in programming so don’t worry about it much just visualize the problem orally or on pen-paper.

Pen and paper to write pseudo code is still the most valuable way to become a better programmer.

You will be surprised how well thinker and problem solver you have become by simply writing pseudo code.

Glimpse of my pseudo code to practise problem-solving

My notes

Another notes

My preparing notes along with pseudo-code for DSA.

Plan of Action

Let’s bring some plan of action on how you can proceed with self-learning of DSA.

Start with Roadmap

Use chat GPT or buy any course that will provide a better DSA roadmap.

https://www.udemy.com/course/master-the-coding-interview-data-structures-algorithms/

  • Start by taking notes and only learn the concepts
  • No need to jump to writing code, just watch the videos, make notes and understand the concepts. You can jump to writing code later on and for the time being simply understand the concepts.

Practise on leetcode or CodeChef

I leave this to you to decide which platform you want to practise DSA, but start with easy mode first and proceed to medium after a couple of days.

No need to get frustrated if you can solve even the easy questions because it’s the starting and we do stumble initially but once we gain experience it will become a cakewalk.

Notes revision for the Interviews

If you are preparing for the interviews your notes will help you to prepare every time for the interview.

Simply revise the notes and you are good to go for the interview

Google DSA Interview practise

I am using Google interviews as the questions because those are solid questions to test our skills.

No need to worry if you won’t get the answer but if you can understand the approach it is still good for the time being.

Google interviews do not just ask for the solution but

  • Google asks for the approach first
  • Google ask to write commented code before the actual code
  • Google then ask to cover edge cases
  • Google then ask for time complexity and space complexity
  • Google then ask to improve the code by thinking out of the box
  • Google will tell you to write code on Google doc instead of editors

It might sound tough but this looks very good to me if we can do all this stuff on our own we have become the good or the best programmer.

Data Structures Interview Questions

DSA Questions

You can use the above repository to get the basic DSA questions asked in Google interviews.

Leetcode for Google Interviews

Leetcode for Interviews

I had a meeting with my friend who has been working in Google India for 2 years and he recommended I practise leetcode medium and hard questions, mostly medium-level questions to crack the interviews.

Once you have covered the topics it’s time to jump to the practise part.

I’ll tell you the approach for practising DSA on leetcode

  • Start with easy problems
  • Think of the problem solution before writing code
  • Think which data structure or tool you can use to solve the problem
  • Then write the pseudo-code in the comments
  • Followed by writing actual code
  • Ask chat GPT for better code to learn a better approach

10 questions for the next 1/2 weeks

You can alter the approach but the best is not to put too much burden on yourself.

Just start with 1–5 questions and proceed with 10 questions each day for the next 1/2 weeks.

You will simply end up practising almost 100 questions and that is enough to become a better programmer.

10 questions for 15 days = 150 questions

and all my friends who are working in Google have solved almost 100–200 questions on the leetcode so this is the key to cracking Google interviews.

Not the only chance

I target the Google interview in the DSA preparation so that even if get rejected we have a very high chance of getting selected by other companies.

Google interviews will teach most of the things to crack any interview in the world.

Google interviews will prepare your DSA accordingly for the top-notch companies in the world.

Even if you are preparing then target the best in the world, why to even settle down for something low?

So prepare for Google and the rest will be taken care of by itself.

Hope for the best and prepare for the worst.

My advice is to know that we might crack Google interviews but we will end up making ourselves a better programmer and that should be the target for every developer.

There are tonnes of companies to grab the job so no harsh or depressed feeling if you don’t make it into Google, it’s just a part and parcel, what’s most important is you can be a better programmer now.

I would anytime feel good to get rejected by Google because being an outsider a non-computer science programmer I still feel obliged to give it a shot, the most satisfying feeling in the world.

References

I am adding tonnes of references for you to prepare accordingly, go ahead with the most demanded yet controversial thing in software development i.e. DSA.

https://www.w3schools.in/data-structures/intro

DSA by freecodecamp

DSA by codeacademy

100 DSA questions

Until next time, have a good day, people
Shrey
iHateReading

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .