DEV Community

Cover image for The Power of Data Structures
Marvin
Marvin

Posted on

The Power of Data Structures

A trip down memory lane avid reader. Let's take a walk through the core of it all: data structures. What are they and why are they so important? A 'hello' to a reader that might have missed our talk on Memory management, where we delved into what happens to our code in variable assignment. Do take a look, even if it's a refresher you're looking for.

Alright then. What is a data structure?

It's a way of organizing data. Say we have a couple of friends coming over for our fortnightly game night( ah...the things on our to-do list). We need snacks, a number of people expected to be there, a list of activities to partake. I can go on and on. So how do we organize this in say a program we want to implement to fix the hustle of planning? How do we store the things to be done or the items to be purchased? It's all data in the end. We need structure. We need data structures. The how of getting our data and manipulating it from these structures are our algorithms.

Right back to our game, who will do what?

adeolu-eletu-DqWEAOHsAvc-unsplash.jpg

How do we decide what comes before what in terms of structuring this data? Does our simple program make it easy to retrieve this information? Is it fast enough? What about efficiency?

Whatever kind of application we are talking about, we need a data structure(s) that will allow traversing, insertion, searching, deletion( in case the last casserole was outright nasty), sorting, or merging of bits of data. Call it CRUD with extra steps.

As from the Memory management article, we got data, then collections of data. It's all data. While memory allocation might not be something we think of with javascript of even Python, it holds water when doing C or C++. So keep this in mind.

Broadly speaking, we group data structures, much like data types in itself, as:

a) Primitive

b) Non-primitive

Primitive structures would hold primitive data types; that is the chars, the int the float. Basically, data types that hold a single value.

Non-primitive structures, on the other hand, break down to linear (which holds data in a sequence) and of course non-linear. Hold your breath in case you lost it a moment there. We'll go into the details soon enough.

As of now, you have a general idea, a scope if you may, of what structures involve.
They are quite a number.

Over the course of the next couple of weeks, we'll be covering some of these structures. Unraveling them to bits and pieces. Finding what makes them tick as so and getting why many a time, developers new and old alike, have challenges addressing them. Stick a while, I cannot wait for our next piece in this!

Top comments (0)