DEV Community

Cover image for What Should I Learn First: Algorithms or Data Structures?
JudoCoder
JudoCoder

Posted on

What Should I Learn First: Algorithms or Data Structures?

So many people are trying to learn computer programming nowadays. It's easy to become overwhelmed with the sheer amount of things to learn. So, should you learn algorithms first or data structures first?

This blog will answer this question for you! We'll go over what these two concepts are, how they're related, and which courses are best for beginners. After reading this blog post, you'll have a better idea of what it is you should be learning!

What is an Algorithm?

An algorithm is a step-by-step set of instructions that tells someone how to solve a problem, usually involving a sequence of mathematical calculations. Algorithms are used in software engineering and computer science to solve problems that are difficult for humans to do by hand.

For example, an algorithm for generating prime numbers is as follows:
1) For any number, check if it's divisible by 2 or 3. If it's divisible by 2 or 3, then stop.
2) If it's not divisible by 2 or 3, then subtract the number from itself until it's divisible by 2 or 3.
3) Keep doing this until you find a value greater than 1 that has no remainder when subtracted from the given number. This is the next prime number and can be found at step 1!

What is a Data Structure?

A data structure is any method that's designed to organize information in an efficient, understandable way. Data structures are important because they allow you to store and manipulate large amounts of data without running into any problems.

Data structures are important because they determine how efficiently your devices will function. They also indicate whether or not your program will work correctly, which means that you should learn what defines them before you learn algorithms.

Why do you need to know about them?

These two concepts are fundamental to learning how to write computer programs. These two concepts, when put together in the right way, allow us to write efficient code.

They are essential when building complex applications that solve a difficult problem. Data structures and algorithms are all around us, from security, to database storage, to file sharing, to voice calls to video chats.

Other than that, if you are trying to get a job in big tech (Google, Apple, Amazon, Facebook, Netflix, etc) you will be asked to solve a complex problem using data structures and algorithms, so it's essential that you know about them.

What do algorithms and data structures have in common?

Algorithms and data structures are both designed to help us with problem-solving. They can be used for a variety of different purposes, such as finding the shortest path in a maze or getting an optimal route between two cities.

Data structures are the first concept that comes to mind when most people think about algorithms. They're essentially mathematical formulas that help us organize information. Data structures are also the foundation for everything else involved in the creation of algorithms.

Another common characteristic that algorithms and data structures share is their use in order to find solutions to problems in an efficient manner. This can be done through pure logic or through testing and analyzing possibilities before making a decision on what's best.

What should you learn first? Data Structure or Algorithms?

There is no right answer here. Because they are interlinked together, you cannot have data structures without algorithms and you cannot use algorithms without having a data structure that is utilized by that algorithm. My approach is to first learn a data structure and then learn an algorithm that uses that data structure.

For example, I would suggest that you first learn about Hashmaps and Dictionaries then practice some hashmap and dictionary coding challenges

Then learn about stacks and queues and practice some stacks and queues coding challenges

While we are at it, if you want to learn what data structures and algorithms should you practice, check out our guide

Where can I study data structures and algorithms?

To start learning about data structures and algorithms, you should find a course in your area of focus. There are many resources out there for beginners to learn from, such as Udemy, Coursera and Khan Academy. Other sources like blogs and YouTube videos offer tutorials on different topics in computer science that can help you get started with the topic that interests you most.

Another website to practice data structures and algorithms is JudoCoder.com We provide hundreds of hand-picked coding challenges that have been asked in an actual interview in big tech companies, such as Google, Facebook, Apple, Twitter, etc.

You should check out our interview prep guides (in the top menu on our website), they cover all essential data structures and some coding challenges that utilize those data structures.

Conclusion

Data structure and algorithms are an essential skill to learn if you want to break into the tech world and get a high paying job in Google, Facebook, Apple, Amazon, Netflix, Twitter, etc.

I hope this guide helped you answer some of the basic questions you had about what you should learn first and how you should approach this subject.

Discussion (0)