DEV Community

loading...

Linear Data Structures:

nashmeyah profile image Nashmeyah ・2 min read

Data Structures and Algorithms is a complicated topic we all know that. I am one of those people that has a hard time wrapping my head around it. I find myself always questioning why I have to learn such complicated topics at an early stage of my development journey and now I feel like I finally understand why.

When building an application or a dynamic webpage, especially for a large audience, things can get complicated very easily very quickly. You cant splatter you code on VS Code and expect the computer to know what to do and where to find things. By studying DSA(data structures and algorithms) you will notice their strengths and weaknesses, which structure to use in your application and so on. As you start applying these to your application, you will start to notice that you've developed a system, you also organized you code. Each DSA allows you to utilize your abilities to manage your data more efficiently and effectively.

"When we think of data structures, there are generally four forms:

Linear: arrays, lists
Tree: binary, heaps, space partitioning etc.
Hash: distributed hash table, hash tree etc.
Graphs: decision, directed, acyclic etc." (2017-2020 integralist)

Linear:

Linear data structures have elements arranged in sequential style, each element is connected the one previous to it as well as after it. This is an easy way to imagine a list, or a stack of CDs, or think of a queue(waiting room).

Tree:

Trees on the other hand are used to abstract data type and to search based on hierarchy of elements. It starts with a root node and branches out, think of an upside down tree. The roots of the tree are known as child nodes and each node has a value.

Hash:

Hash table is a data structure that associates keys to values. Think of addresses, address owner, address location, address zip...etc. Using this data structure is very beneficial when handling accounts for thousands of people, you can easily sort based on certain criteria.

example:

id:
1:  ->  owner: [address:]-> location:[...]
2:  ->  owner:
3:  ->  owner: [address:]-> location:[...]
Enter fullscreen mode Exit fullscreen mode

owner: => key
[address:] => value

location: => key
[...] => value

Graph:

A graph is a structure that has a finite set of nodes with edges connecting them, (x,y) is a pair referred to as an edge. Elements in a graph share connections each element is a node connecting to an edges, Think of google maps, GPS, social media or like a pirate map "x marks the spot".

Thank you for taking your time reading this, I had the goal to summarize each of these data structures in a very simple way to get whomever a brief overview on what they are rather then being overwhelmed with all the data on the inter-webs.

Have a wonderful day, don't forget to smile! :D

Discussion (1)

pic
Editor guide
Collapse
abhilearnstocode profile image
Abhijeet

Nice one Nashmeyah!
Infact I'm writing a series on data structures.
Hope you like it! Here's the link Hello World of Data Structures