General

Data Structures – Overview

Learning about data structures is important to any undergraduate who’s willing to be a software engineer. There are some main questions that pop into our mind when it comes to these.

  • What are data structures and algorithms?
  • Why do we need to learn them?
  • Can’t we use arrays and loops to handle the data?
  • What good does it do to my code when I use these?

To answer all these questions, first let us see what data structures and algorithm means

Data Structures and Algorithms

Data Structure: It is an arrangement of the data we use in the memory. It can be computer memory or a disk. The basic data structures we all know is the arrays. But there are much more. Including linked lists, stack, binary trees, hash tables, queues, heaps, graphs etc.

Algorithms: These are used to manipulate the data using the structures mentioned above in various ways to do a task. Such as inserting data, searching, sorting the data, deletion of data or even to display or perform some other action.

Why should you learn about data structures and algorithms?

As a programmer, we usually deal with logics. When we are programming, there are scenarios that we need to identify the best way to store data, to access data etc.

And there are many ways we can implement the same solution. But it is programmer’s responsibility to identify the optimal solution.

When you lean about data structures, you gain the knowledge on how it works, and you will get an idea on how it is used. even the algorithms.

When you have the knowledge about them, you will eventually get used to apply the optimal data structure or the algorithm that is most suitable for the problem you are solving.

Can’t we use arrays and loops to handle the data?

Imagine a situation where you need to handle an insertion and deletion of data. If your data is around 10 – 100 items, you will not feel a huge delay in insertion.

When your insertions are more than thousands and millions of data, using an array will make the system slow.

Because, when inserting for an ordered array, you might need to shift elements. And if you are deleting from an unordered array if will take time to search and identify the element from the array and to delete and shift the elements back.

And how are you going to handle new data when the length is fixed?

That is why, there are other data structures that has been introduced to improve the time and space usage of the data manipulation.

What good does it do to my code when I use these?

As I said earlier, there are many data structures to choose from and it is your skill to identify the most suitable structure to use according to the situation.

Using data structures and algorithms in your code will reduce the time and space complexity the system takes to do manipulations.

And also it is easier to read the code and understand the logic.

Each structure has its own advantages and disadvantages. By having the necessary knowledge, you can get an idea on what to choose and what not to.

Here is a summary list of commonly used data structures and its pros and cons for your reference.

Data Structures - Overview
Data Structures – Overview

Let’s discuss more about each data structure in the next article.

Keep in touch with TechEdify !