Data Structures

Structure your data according to your needs!

Photo by Lukas Blazek on Unsplash

There are different ways to structure your data depending on what it is and how you want to organize and store it depending on how you plan to use it.


Photo by American Public Power Association on Unsplash

An array is a container object that holds a fixed number of values of a single type, e.g an array of integer will only have integers.

A few operations that can be performed on the array is traversing. You can traverse the array by accessing every single element within that array, whether you want to add them all up and get a single integer or print out every single element of that array. You can also search within the array by the index or by the element, this will allow to access whatever element within that array you need. And you can also update the array, insert and delete to and from the array. But, because they are fixed in size, you would actually have to create a whole entire new array and do the current size plus one, if you are inserting something into the array. And the same goes for deleting an element, you will have to do the current size minus one, that is the length of your new array copy all existing except for the one you want to delete into that new array.


Photo by Alan Yan on Unsplash

A linked list is a linear data structure where each element is a separate object. The elements of a linked list is not stored in a contiguous location, it actually consists of sequence of items in a linear order that are linked together using pointers so you would have to access the data sequentially rather than having random access like in an array. The elements within a linked list are referred to as nodes and each node is made up of the value as well as the pointer. these are typically known as key for value and next for the pointer. The beginning of a linked list is called head and that points to the first element in that linked list and the end of the linked list is the tail and the next is the null.

There are three different types of linked list:

> Singly linked list

> Doubly linked list

> Circular linked list

The one discussed above is a singly linked list so, you are able to traverse from forward to backward, but also each node which previously consisted of just a key and next, also has a previous(pre for short). This is the same as next however it’s pointer to its previous predecessor node rather its successor node. In a circular linked list, when the tail points to the head and the head points to the tail.

For the operations, you can search in a linked list and this is a sequential search or a linear search, you will be starting at the beginning and going backwards looking for the first element for the key of your choice, so if you are looking for particular words with particular characters that could be one and whenever a character “A” pops up then you return a pointer to its element . You can also insert into a linked list, it is not fixed in size so you can just insert in the beginning of it, to the end of it or in the middle. And the same rule applies when you want to delete from a linked list.


A stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO (last in first out) or FILO(first in last out). There are two operations performed when it comes to stacks stack: push and pop. Push is when you are inserting something to the top of the stack and pop is when you are deleting and returning something at the top of the stack.

There are different ways to check the status of the stack. You can see that is returning what is at the top of the stack without deleting it, you can check if it is empty or full.

The applications of stacks is for parsing and evaluating mathematical expressions so you can use it for expression evaluation and you can use it to implement function calls in recursive programming.


A queue is a linear structure which follows a particular order in which the operations are performed. The order is first in first out (FIFO).

There are two basic operations you can perform on a queue, and enqueue and a dequeue. With an enqueue, you are inserting an element to the end of the queue and with a dequeue, you are deleting and element from the beginning of the queue.

Few applications of queues are that queues are used to manage the threads in multi-threading and to implement queue systems like priority queues.

Hope this was helpful. Happy Coding guys!!



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
Farzana Karim

Farzana Karim

Software Engineer | Day Dreamer | Get Better by the Day