Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Data Structures

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

What is Data Structure: Need, Types &

Classification
A data structure is a collection of data values and the relationships between them. Data
structures allow programs to store and process data effectively.. Some of the most common
data structures are arrays, lists, trees, and graphs.

Data Structure is used for organizing the data in memory. There are various ways of
organizing the data in the memory, for eg. array, list, stack, queue, and many more.!

The data structure isn’t a programming language like C, C++, Java, etc. It is a set of
algorithms that can be used in any programming language to organize the data in the
memory.

Need of Data Structure

As applications are becoming more complex and the amount of data is increasing day by day,
which may cause problems with processing speed, searching data, handling multiple requests
etc. Data structure provides a way of organizing, managing, and storing data efficiently. With
the help of data structure, the data items can be traversed easily. Data structure provides
efficiency, reusability and abstraction. It plays an important role in enhancing the
performance of a program because the main function of the program is to store and retrieve
the user’s data as fast as possible.

Why Learn Data Structure?

Data structure and algorithms are two of the most important aspects of computer science.
Data structures allow us to organize and store data, while algorithms allow us to process that
data in a meaningful way. Learning data structure and algorithms will help you become a
better programmer.

Types of Data Structure

There are 2 types of Data Structure:

 Primitive Data Structure


 Non – Primitive Data Structure
Primitive Data Structure –

Primitive Data Structures directly operate according to the machine instructions. These are
the primitive data types. Data types like int, char, float, double, and pointer are primitive data
structures that can hold a single value.

Non – Primitive Data Structure –

Non-primitive data structures are complex data structures that are derived from primitive data
structures. Non – Primitive data types are further divided into two categories.

 Linear Data Structure


 Non – Linear Data Structure
Linear Data Structure –

Linear Data Structure consists of data elements arranged in a sequential manner where every
element is connected to its previous and next elements. This connection helps to traverse a
linear arrangement in a single level and in a single run. Such data structures are easy to
implement as memory is additionally sequential. Some examples of Linear Data Structure are
List, Queue, Stack, Array etc.

Types of Linear Data Structure –

1] Arrays –

An array is a collection of similar data elements stored at contiguous memory locations. It is


the simplest data structure where each data element can be accessed directly by only using its
index number.
2] Linked List –

A linked list is a linear data structure that is used to maintain a list-like structure in the
computer memory. It is a group of nodes that are not stored at contiguous locations. Each
node of the list is linked to its adjacent node with the help of pointers.

3] Stack –

Stack is a linear data structure that follows a specific order during which the operations are
performed. The order could be FILO (First In Last Out) or LIFO (Last In First Out).

The basic operations performed in stack are as follows:

 Push – Adds an item within the stack.


 Pop – Deletes or removes an item from the stack.
 Top – Returns the topmost element of the stack.
 Is Empty – Returns true if the stack is empty.
4] Queue –

Queue is a linear data structure in which elements can be inserted from only one end which is
known as rear and deleted from another end known as front. It follows the FIFO (First In
First Out) order.

 Deque – Adds an element to the queue.


 Enqueue – Deletes or removes an element from the queue.
 IsFull – Returns true if the queue is full.
 IsEmpty – Returns true if the queue is empty.

Non-Linear Data Structure –

Non-linear Data Structures do not have any set sequence of connecting all its elements and
every element can have multiple paths to attach to other elements. Such data structures
support multi-level storage and sometimes can’t be traversed in a single run. Such data
structures aren’t easy to implement but are more efficient in utilizing memory. Some
examples of non-linear data structures are Tree, BST, Graphs etc.

Types of Non-Linear Data Structure

1] Tree –

A tree is a multilevel data structure defined as a set of nodes. The topmost node is named
root node while the bottom most nodes are called leaf nodes. Each node has only one parent
but can have multiple children.

Types of Trees in Data structure

 General Tree
 Binary Tree
 Binary Search Tree etc
2] Graph

A graph is a pictorial representation of a set of objects connected by links known as edges.


The interconnected nodes are represented by points named vertices, and the links that connect
the vertices are called edges.

Types of Graph

 Finite Graph
 Infinite Graph
 Trivial Graph
 Simple Graph
 Null Graph
 Pseudo Graph
Classification of Data Structure

Data Structure can be further classified as

 Static Data Structure


 Dynamic Data Structure
Static Data Structure

Static Data Structures are data structures where the size is allocated at the compile time.
Hence, the maximum size is fixed and cannot be changed.

Dynamic Data Structure

Dynamic Data Structures are data structures where the size is allocated at the run time.
Hence, the maximum size is flexible and can be changed as per requirement.
Data Structure Operations –

The common operations that can be performed on the data structures are as follows:

 Searching – We can easily search for any data element in a data structure.
 Sorting – We can sort the elements either in ascending or descending order.
 Insertion – We can insert new data elements in the data structure.
 Deletion – We can delete the data elements from the data structure.
 Updation – We can update or replace the existing elements from the data structure.
Advantages of Data Structure –

1. Data structures allow storing the information on hard disks.


2. An appropriate choice of ADT (Abstract Data Type) makes the program more efficient.
3. Data Structures are necessary for designing efficient algorithms.
4. It provides reusability and abstraction.
5. Using appropriate data structures can help programmers save a good amount of time
while performing operations such as storage, retrieval, or processing of data.
6. Manipulation of large amounts of data is easier.
Data Structure Applications
1. Organization of data in a computer’s memory

2. Representation of information in databases

3. Algorithms that search through data (such as a search engine)

4. Algorithms that manipulate data (such as a word processor)

5. Algorithms that analyze data (such as a data miner)

6. Algorithms that generate data (such as a random number generator)

7. Algorithms that compress and decompress data (such as a zip utility)

8. Algorithms that encrypt and decrypt data (such as a security system)

9. Software that manages files and directories (such as a file manager)

10. Software that renders graphics (such as a web browser or 3D rendering software)

You might also like