Why Data Structures?

Making the best out of any structure is an art!

Data Structures
Data Structures

Ever thought of what Bitcoin actually is? Or, how do systems store data? Why systems come into the configuration of 32 bits and 64 bits? Anyone can learn how to code, but how to write an optimized code is the real challenge. Since we have limited storage capacity, we need to store data in a manner that consumes less memory yet gives the most time-efficient output. A good code possesses three factors: Readability, Time-complexity, and Space-complexity.

Well, in a nutshell, a data structure is a collection of data and how it can be stored. There are many data structures and every data structure differs in what it can do, how it can store or access data, and what it is best used for. The interesting part to note here is that each one of them is specialized for its own good thing.

If we think about it, you can actually view data structures as any sort of compartment or container where every container is supposed to store a specific type of thing. For instance, you store food in a refrigerator, notebooks in a backpack, shoes or clothes in a drawer, or documents in a folder. Now, you cannot put ice creams in a drawer or lose documents in a backpack or shoes in the refrigerator. Things will really get messy out there! So each one of these containers is specific for its own thing and that’s what data structure really is. So now thinking of data structures in a broad manner, it is a way to organize data so that we can take things from it in a really easy manner. We can go to a refrigerator to grab an ice-cream, backpack to pick some notebooks or books.

Data Structures are of multiple types as one can see here in the Wikipedia link. But what comes in handy are only 5 or 6. Mainly Arrays, Stacks, Queues, Linked Lists, Graphs, Trees, Hash Tables. Now, if we talk about what all kinds of data are being stored in these, then it actually depends on the data types and the programming language you use. Each language has its own data types or built-in datatypes and each language has data structures to organize these datatypes. Python, for example, has numeric, string, boolean (true or false) as data types and list, dictionary, set, tuples as built-in data structures.

Does this mean that if we are using Python, we only have the above-mentioned data structures, or if we are using Javascript, we can only use arrays and objects as data structures? Well no not really! We can actually create our own data structures. So if javascript doesn’t have stacks, we can build one, or if python doesn’t have linked lists or stacks, we can create one using lists.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adwiteeya Reyna

Adwiteeya Reyna

Software Developer | Web Developer | Database Developer