Have you ever came across such a term as "Data Structures"? Perhaps someone has mentioned it when discussing the skills that every programmer should have. Maybe this subject came up in school or college. Or in one of the many articles talking about how to start your programming career.
Data structures are nothing more than a way to store data in a computer's memory. And they are one of the fundamental skills in programming in general.
A good understanding of the basics will help you write better code
Many programming languages provide predefined data structures that are ready to use. It certainly makes your work easier but in this way you can sometimes get lost. Lack of understanding and complexity of a given structure often leads to writing suboptimal code with questionable performance. With this also comes the risk of increased vulnerability to bugs.
I do not mean to resign completely from the structures available in the language. On the contrary - they are there to be used. However, it is important to understand what the use of a given structure is connected with and what problems you may encounter. And that's why I suggest you to learn and have a good understanding of basic data structures. This is a very universal skill that will stay with you for life. And you will be able to use this knowledge in any programming language.
You can describe data structures with real life examples
I have prepared examples for you of some common structures.
- Queue - imagine a checkout line at a store. First come, first served.
- Stack - imagine a stack of pancakes where the newest pancakes are added on top.
- Tree - imagine picking fruit from a high up branch. We start from the root and have to climb up to smaller and smaller branches.
As you can see, this is not secret knowledge. Such structures can (and in my opinion even should) be described in simple, understandable language.
What is this really about?
Look now at an example of a simple structure called a "tree". This is what it might look like in practical application:
We are at the beginning (root) in this green circle. We want to get to the cherry on top which is the red circle.
Our job is to find the right way. Look at how we can get to the cherry:
If you can find your way to the top, to the cherry, then you will also be able to write optimal algorithms that search for data. And that's what these data structures are all about. If you understand these issues well then you will be able to put them to optimal use in practice when writing code in any language. Want to learn more about trees and other structures?
Start with this course Data Structures - Level 1
What you need to know to get started
At the beginning, it will be enough for you to master a few basic structures. By mastering I mean gaining skills which will allow you to evaluate the usefulness of using the given structure in practice. To such basic structures we can include: list, queue, stack and different varieties of tree (e.g. binary tree). This is a fundamental, universal set, which will help you for a long time and can be useful literally at every step.
Data structures - important and indispensable knowledge
I hope that now you know what data structures are and how important they are in programming. Ready to start your adventure with structures?
I encourage you to take the course prepared by me, which will explain all the details.
Tomasz - JAVA/Node.js Curriculum Manager