Introduction of Data Structure - PPT
Introduction of Data Structure - PPT
Structure
What is Data Structure
Data Structure is a way of collecting and organizing data in such a way that we
can perform operations on these data effectively
The data can be managed in various ways, like the logical or mathematical
model for a specific organization of data is known as a data structure.
Some examples of Data Structures are Arrays, Linked Lists, Stack, Queue, Trees,
etc. Data Structures are widely used in almost every aspect of Computer
Science, i.e., Compiler Design, Operating Systems, Graphics, Artificial
Intelligence, and many more
Need of data structure
Data Structures support different methods to organize, manage, and store data
efficiently
With the help of data structure the data items can be traverse easily
1. Primitive Data Structures are the data structures consisting of the numbers
and the characters that come in-built into programs.
3. Basic data types like Integer, Float, Character, and Boolean come under the
Primitive Data Structures.
4. These data types are also called Simple data types, as they contain characters
that can't be divided further
Non-Primitive Data Structures
A data structure that preserves a linear connection among its data elements is
known as a Linear Data Structure
The arrangement of the data is done linearly, where each element consists of
the successors and predecessors except the first and the last data element
1. Static Data Structures: The data structures having a fixed size are known as Static Data
Structures. The memory for these data structures is allocated at the compiler time, and
their size cannot be changed by the user after being compiled; however, the data stored in
them can be altered.
The Array is the best example of the Static Data Structure as they have a fixed size, and its
data can be modified later.
2. Dynamic Data Structures: The data structures having a dynamic size are known as
Dynamic Data Structures. The memory of these data structures is allocated at the run time,
and their size varies during the run time of the code. Moreover, the user can change the
size as well as the data elements stored in these data structures at the run time of the
code.
Linked Lists, Stacks, and Queues are common examples of dynamic data structures
Types of linear data structure
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.
Linked Lists
A Linked List is another example of a linear data structure used to store a collection of data
elements dynamically.
Data elements in this data structure are represented by the Nodes, connected using links or
pointers.
Each node contains two fields, the information field consists of the actual data, and the pointer
field consists of the address of the subsequent nodes in the list.
The pointer of the last node of the linked list consists of a null pointer, as it points to nothing.
Unlike the Arrays, the user can dynamically adjust the size of a Linked List as per the
requirements.
Stack:
A Stack is a Linear Data Structure that follows the LIFO (Last In, First Out) principle that
allows operations like insertion and deletion from one end of the Stack, i.e., Top.
Stacks can be implemented with the help of contiguous memory, an Array, and non-
contiguous memory, a Linked List.
Real-life examples of Stacks are piles of books, a deck of cards, piles of money, and many
more.
Data structures where data elements are not arranged sequentially or linearly
are called non-linear data structures.
In a non-linear data structure, single level is not involved. Therefore, we can’t
traverse all the elements in single run only.
linear data structures are not easy to implement in comparison to linear data
structure.
It utilizes computer memory efficiently in comparison to a linear data structure.
Examples are trees and graphs.
Types of Non-Linear Data Structures
The following is the list of Non-Linear Data Structures that we generally use:
1. Tree:
A Tree is a Non-Linear Data Structure and a hierarchy containing a collection of
nodes such that each node of the tree stores a value and a list of references to
other nodes (the "children").
Trees can be classified into different types:
• General Tree
• Binary Tree
• AVL Tree
• N-ary Tree
2. Graphs:
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.
The Graph data structure, G is considered a mathematical structure comprised of
a set of vertices, V and a set of edges, E as shown below:
Null Graph
Trivial Graph
Simple Graph
Multi Graph
Pseudo Graph
Non-Directed Graph
Directed Graph
Connected Graph
Disconnected Graph
Regular Graph
Complete Graph
Cycle Graph
Infinite Graph
Bipartite Graph
Planar Graph
Euler Graph
Hamiltonian Graph
Cyclic Graph
Acyclic Graph
Finite Graph
Basic Operations of Data Structures
In the following section, we will discuss the different types of operations that we
can perform to manipulate data in every data structure.
Update: The Update operation allows us to update or modify the data in the data
structure. We can also update any particular data by specifying some conditions
inside the loop, like the Selection operation.
Splitting: The Splitting operation allows us to divide data into various subparts
decreasing the overall process completion time.