Data structures – Introduction

By | 4th May 2020

Definition

Data Structures are a way of collecting and organizing data in a memory and we can perform operations in an effective manner.

Why we need data structures?

The main purpose is used to organize and manage the data efficiently. In the programming world, an organized way of storing and retrieving data will improve the performance of any program drastically. This will eventually reduce the operational cost and resource utilization.

 Let’s take a real-time example. We have two bookshelves and we need to arrange the books on those shelves. Assume that we have 100 books. On the first shelf, we arranged 50 books randomly. On the second shelf, we organized the remaining 50 books based on 4 categories like fiction, thriller, short stories, and novels. If you want to retrieve one of the fiction novels you know from which shelf you can pick the book quickly. Like that in programming, there are different data structures and you can use for different purpose. Using them effectively will make a big difference in your program.

Classification of Data Structures

Data Structure is classified into two categories. According to these we can retrieve or manage data. There are various ways to classify data structure.

Primitive and Non – Primitive

Primitive data types or structures are predefined data types. They are supported by all programming languages. Examples are integer, real, and characters.

Non-primitive data types are not predefined in programming languages. They can be implemented with the help of primitive data types. Examples are records, array, and string.

Linear and Non – Linear

In a linear DS, the data items are arranged in a sequential manner. Example: Arrays.

In a non-linear DS, the data items are arranged in a random manner. Example: Trees and graphs.

Also check, “Types of Data structures”