Basics of Data Structure

What is a Data Structure?

A data structure is a way of organizing data so that it can be used effectively. We use data structures to organize data in some fashion so that later on it can be accessed, queried, updated or deleted quickly and easily. Main motive behind using data structure is to reduce time and space complexities of tasks.

Why Data Structures?

  • Data Structures are a path to create fast and efficient algorithms.
  • They help to manage and organize data in an efficient manner.
  • They make code cleaner and easier to understand.

The above mentioned features make data structures an important part in the life of a computer programmer. Use of data structures make the difference between a new programmer and an experienced programmer. Computer science graduates are required to take a course on data structures signifies its importance.

Abstract Data Type vs. Data Structures

An abstract data type is an abstraction of a data structure which provides only interface to which data structure must adhere to. Let me explain it in a simple way,

Abstract Data Type or ADT is a class that contains only values and type of operations. It does not contain the detail of the implementation of operations. Read here regarding abstraction. The detail of the implementation of these operations is data structures. Take the example of implementation of list data type. Here, the class list containing name of the operations and the required data is an abstract data type, while the implementation for this can be done using Dynamic Array, Linked list or some other data structures.

Take a look at the table below.

Abstract Data Type(ADT)Data Structure(DS)
ListDynamic Array
Linked List
QueueArray Based Queue
Stack Based Queue
MapTree Map
Hash Map

Advantages of Data Structures

Data structures are implemented in the program because of their efficiency. Data structures used in a particular situation can reduce the running time of the program by a factor of more than 100, in some cases even by 1000 times.

Once you have implemented a particular data structure, you can use the same in your other projects. It is to say that, data structures are reusable.

As all the data structure have a particular type of implementation, so a experienced programmer can understand the same very fast. So, implementing data structure helps to make the code cleaner.

Types of Data Structures

Data Structures are divided into two different parts Primitive Data Structure and Non-Primitive Data Structure. All the primitive data types can be found here.

Primitive Data Structures

  • Boolean
  • Character
  • Integer
  • Floating Point

Non-Primitive Data Structures

  • Linear
    • Array
    • Linked List
    • Stack
    • Queue
  • Non – Linear
    • Tree
    • Graph

Leave a Reply