While I studying in computer science graduation there was a separate subject called data structures. But I don't understand what is it till last week.
I wanted to explain the way I needed while at my college. I wanted to explain the real-world example first and how can we use it in software development.
What is data structures?
Official
In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.
I understand this explanation is not feasible. Let me explain in layman terms.
Layman term
In real-world, imagine you have some items like eggs, vegetables, vessels, etc., And you need to store all the items. How would you do it? It's not possible to store all the items in the same storage. If you do means eggs will break. So, you need to come up with an efficient solution that the items can be easily retrieved whenever you need and also you can add a certain item easily. How would you do it?
This is where the data structures come to the game. So now you are using different storage structure for different items that the items can be added/removed/accessed from the data storage efficiently.
How can we use it in daily programming?
Good question! In javascript, there are two data structures we are using array and objects both are good in their purposes. In some cases, you might be needed to insert the value in front of the array instead of to the last. In this case, inserting value to the front is very costlier (we'll discuss it later). So array won't be helpful in this case but there are other data structures will be helpful eg: Linked List. Inserting a value to the front is constant time in the linked list.
We'll discuss more on different data structures and how to implement in daily development in upcoming blogs.
Simple right?
Type of data structures:
- Singly Linked List
- Doubly Linked List
- Stacks
- Queues
- Binary Search Trees
- Tree Traversal
- Binary Heaps
- Hash Tables (Javascript Objects)
- Graphs
- Graph Traversal
I'll write a separate blog post for each data structures. Hope you understand what is data structures and why we are using it. Please comment on your feedback about my blogs.
Thanks!
Top comments (1)
Thanks alot about this explanation now I can really understand why we need data structures in our daily programing
I will be waiting for your upcoming blogs on this 🙃