SlideShare una empresa de Scribd logo
1 de 25
DATA STRUCTURE
Demo lecture
What is Data Structure?
A data structure is a way of organizing and storing
data in a computer system or programming
language. It provides a systematic way of
managing and accessing data, allowing efficient
operations such as insertion, deletion, searching,
and retrieval.
Classification of data structure
Data
structure
Linear Data structure
Static data structure Array
Dynamic data structure
Linked list
Stack
Queue
Non-linear Data structure
Tree
Graph
Linear Data Structure
A linear data structure organizes and stores data where
the elements form a linear sequence. Elements are
accessed sequentially, typically one after another, with a
clear first and last element. Examples of linear data
structures include arrays, linked lists, stacks, and
queues.
Further classified as Static and Dynamic data structure.
Static data structures have a fixed size and memory
allocation, while dynamic data structures can grow or
shrink in size during program execution.
Arrays
Linear
Data
structure
Linked
List
Stack
Queue
Arrays
Arrays are a fundamental data structure that stores a
fixed-size sequence of elements of the same type. They
provide a contiguous block of memory where elements are
accessed using their indices. Arrays offer efficient random
access and constant-time element retrieval and are
suitable for situations where the collection size is known
in advance or does not need to change dynamically. Let us
discuss:
• Characteristics of an array
• Array operations
• Applications
1 2 3 4 5
0 1 2 3 4
A1
100 101 102 103 104
1 2 3 4
A2 5 6 7 8
9 10 11 12
1 2 3
A3 4 6 7 8
7 10 11 12
11 12 13
14 6 7 8
17 10 11 12
21 22 23
24 25 26
27 28 29
1-D Array
2-D Array
3-D Array
Characteristics of Array
Index-based data structure
Consists of homogeneous elements i.e. elements of the same data types
Predetermined or fixed size
Elements are stored at contiguous memory locations
Random access to elements (as they can be accessed using their indices)
Array Operations
Accessing Elements: Direct access using the array[index]
Searching: specific elements can be searched using Linear
or Binary search.
Sorting: can be sorted in ascending or descending order
using bubble sort and quick sort algorithms.
Insertion: elements can be inserted at a specific index by
shifting existing elements.
Deletion: elements can be removed from specific indices,
and then gaps are filled by shifting the remaining elements
Updating Elements: Array elements can be modified by
assigning a new value to a specific index.
1 2 3 4 5
0 1 2 3 4
A1
8 8 is to be added at index 2.
1 2 8 3 4
0 1 2 3 4
A1 5
5
1 2 3 4 5
0 1 2 3 4
A1
Insertion Operation
Deletion Operation
Applications of Array
Data storage and retrieval: Arrays order data. An array can hold student scores or weather
station temperatures.
Sorting: Arrays can sort data in ascending or descending order. Sorting algorithms such as
bubble sort, merge sort, and quicksort rely heavily on arrays.
Searching: Arrays can be searched for specific elements using linear and binary search
algorithms.
Stacks and queues: Arrays are the underlying data structure for implementing stacks and
queues, commonly used in algorithms and data structures.
Graphs: Arrays can be used to represent graphs in computer science. Each element in the array
represents a node in the graph, and the relationships between the nodes are represented by the
values stored in the array.
Dynamic programming: Dynamic programming algorithms often use arrays to store
intermediate results of subproblems to solve a more significant problem.
Linked Lists
A linked list is a dynamic data structure consisting of a sequence of nodes, where each node
contains data and a reference (or link) to the next node. Linked lists can expand or shrink without
contiguous memory allocation, unlike arrays. Linked lists are employed when the collection size
changes often or when efficient insertion and deletion operations are needed. Types are:
• Singly-linked lists
• Doubly linked lists
• Circular linked lists
• Doubly circular linked lists
Head
Data Next Data Data Data
Next Next Next NULL
Types of Linked Lists
1.Singly Linked List: In a singly linked list, each node contains data and a reference (or link) to the
next node. It allows traversal in only one direction, from the head (start) to the tail (end) of the
list.
2. Doubly Linked List: Each node references the next and previous nodes in a doubly linked list.
This allows for bidirectional traversal, enabling operations like traversal in both directions,
insertion/deletion at both ends and reverse traversal.
Types of Linked Lists
3. Circular Linked List: The last node's reference points back to the first node, forming a
loop in a circular linked list. This allows for continuous traversal without a defined end.
4. Doubly Circular Linked List: A combination of a doubly linked list and circular linked
list, this type has nodes with references to both the next and previous nodes and the last
node's reference points back to the first node, forming a circular loop. It enables
bidirectional traversal and continuous looping.
Characteristics of Linked List
Dynamic size: nodes can easily be inserted and deleted making the linked list dynamic in size.
Non-contiguous memory: Each node in a linked list contains a reference to the next node,
allowing for flexible memory allocation.
Node Structure: Linked lists consist of individual nodes containing data and a reference (or
link) to the next node in the sequence. This structure enables sequential traversal and
manipulation of elements.
Sequential access: Starting at the list head, linked lists sequentially access elements. Random
access is not efficient.
Dynamic Memory Allocation: Linked lists efficiently allocate memory as nodes are added. They
can handle data of various sizes and changing needs due to their flexibility.
Operations on Linked List
Insertion: Nodes can be inserted at the beginning, end, or at a specific position within the
linked list. Insertion involves creating a new node, adjusting the links, and updating the
references of neighboring nodes.
Deletion: Nodes can be removed from the linked list. Deletion involves updating the references
of neighboring nodes to bypass the deleted node and freeing the memory occupied by the node.
Traversal: Linked lists can be traversed sequentially to access or modify each element. Starting
from the head node, each subsequent node is visited until the end of the list is reached.
Searching: Linked lists can be searched for a specific value or element. It involves traversing
the list and comparing the data in each node with the target value.
Applications of Linked List
Linked Lists are used to implement stacks and queues.
It is used for the various representations of trees and graphs.
It is used in dynamic memory allocation( linked list of free blocks).
It is also used for performing arithmetic operations on long integers.
It is used for finding paths in networks.
In operating systems, they can be used in Memory management, process scheduling, and file
systems.
Linked lists can be used to improve the performance of algorithms that need to frequently insert
or delete items from extensive collections of data.
Stacks
A stack is a linear data structure that follows the Last-In-
First-Out (LIFO) principle. It can be visualized as a vertical
stack of objects, where the last object placed on top is the first
to be removed. The operations performed on a stack are:
Push: It adds an element to the top of the stack, increasing
its size. The new element becomes the top element.
Pop: It removes the top element from the stack, reducing its
size. The element that was below the top element becomes
the new top element.
Peek/Top: It retrieves the value of the top element without
removing it.
A
B
C
D
PUSH POP
STACK
Application of Stacks
Function calls and recursion: Stacks are used by programming
languages to manage function calls and recursive operations.
Expression evaluation: Stacks are employed to evaluate arithmetic
expressions, convert infix expressions to postfix or prefix notation,
and perform postfix/prefix expression evaluation.
Undo/Redo operations: Stacks can implement undo and redo
functionality in applications, keeping track of previous states or
actions.
Backtracking and depth-first search: Stacks are utilized in
algorithms that require backtracking or depth-first traversal, such as
maze solving or tree traversal.
Memory management: Stacks play a role in managing memory
allocation and deallocation, specifically in the context of function
calls and local variables.
Queue
A queue is a linear data structure that follows the First-In-First-Out (FIFO) principle.
It can be visualized as a horizontal line of objects, where the first object inserted is the
first one to be removed. The operations performed on a queue are:
Enqueue: It adds an element to the back (end) of the queue. The size of the queue
increases, and the new element becomes the last element in the queue.
Dequeue: It removes the element from the front (beginning) of the queue. The queue
size decreases, and the element second in line becomes the new front element.
Peek/Front: It retrieves the value of the front element without removing it.
Application of Queue
Process scheduling: Queues are used in operating systems to
manage the scheduling of processes, ensuring fairness and orderly
execution.
Print spooling: Queues are utilized in print spoolers to manage print
jobs in the order they were received.
Task management: Queues can manage tasks in a multitasking
environment, ensuring that tasks are executed sequentially.
Breadth-first search: Queues are employed in algorithms like
breadth-first search, where elements are explored in a level-by-level
order.
Buffering and synchronization: Queues can buff data between
processes or threads, ensuring proper synchronization and
communication.
Tree
A tree is a nonlinear hierarchical data structure
composed of nodes. It is often visualized as an
upside-down tree, with a single node called the root
at the top and the remaining nodes arranged in levels
or layers below. Trees have various types and
variations, including:
• Binary Tree: A binary tree is a tree in which each
node can have at most two children, referred to as
the left and right child.
• Binary Search Tree (BST): A binary search tree is
a binary tree that follows a specific ordering
property. The value of the left child is less than the
parent node, and the value of the right child is
greater than or equal to the parent node.
Tree
Key concepts in trees include:
• Nodes: Each element in a tree is called a node. Nodes may contain data or
information.
• Root: The root is the topmost node in the tree. It serves as the starting point for
traversing the tree.
• Parent and Child Nodes: Nodes in a tree can have relationships with other nodes. A
node directly connected to another node is called its child, and the node it is
connected to is called its parent. Each node can have multiple children.
• Leaf Nodes: Leaf nodes, or terminal nodes, are nodes without children. They are
located at the bottommost layer of the tree.
• Siblings: Nodes that share the same parent are called siblings.
• Subtree: A subtree is a portion of a tree consisting of a node and its descendants,
including all its children, grandchildren, etc.
Applications of Tree
Trees find application in various areas, including:
• File Systems: Trees represent the hierarchical structure of files and directories in file
systems.
• Database Systems: Tree structures like B-trees are used in database indexing and
searching.
• Hierarchical Representations: Trees can represent organizational hierarchies, family
trees, or class hierarchies in object-oriented programming.
• Decision-Making and Game Algorithms: Trees can model decision-making processes
and game trees in artificial intelligence algorithms.
• Network Routing: Trees are employed in network routing algorithms, such as spanning
trees used in network topology.
Graph
A graph is a non-linear data structure that consists of a
collection of nodes (vertices) connected by edges. It is a
powerful data structure for representing relationships
between objects. Graphs can be categorized into different
types, including
• Directed Graph (Digraph): A graph in which the edges
have a specific direction, indicating a one-way
relationship between nodes.
• Undirected Graph: A graph in which the edges have
no specific direction, indicating a bi-directional
relationship between nodes.
• Weighted Graph: A graph in which edges are assigned
weights or costs to represent the relationships between
nodes' strength, distance, or importance.
Graph
Key concepts in graphs include:
• Nodes (Vertices): Nodes are the fundamental units of a graph and represent objects
or entities. Each node can hold additional information, such as data or attributes.
• Edges: Edges connect pairs of nodes and represent their relationships or
connections. An edge can be directed (pointing from one node to another) or
undirected (bi-directional).
• Adjacency: An edge connecting two nodes is considered adjacent.
• Weight: Edges can be assigned a weight or cost, indicating the strength, distance, or
importance of the relationship between connected nodes. Weighted graphs are used
in various algorithms, such as shortest-path algorithms.
• Path: A path in a graph is a sequence of nodes connected by edges. It represents a
route or sequence of connections between nodes.
Applications of Graph
Graphs find application in various areas, such as:
Social Networks: Graphs are used to model social networks, where nodes represent
individuals, and edges represent relationships or connections between them.
Network Routing: Graphs are used to model and analyze network topologies for efficient
routing and communication in computer networks.
Recommendation Systems: Graphs are used to build recommendation systems that suggest
items, connections, or content based on relationships and patterns within the graph.
Web Crawling: Graphs represent and navigate the interconnected structure of web pages
during web crawling and indexing.
Transportation and Logistics: Graphs are used in route planning, optimizing
transportation networks, and solving problems like the traveling salesman problem.
THANK YOU

Más contenido relacionado

Similar a Data_structure.pptx

Data structure & algorithms introduction
Data structure & algorithms introductionData structure & algorithms introduction
Data structure & algorithms introductionSugandh Wafai
 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS Adams Sidibe
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxUsriDevi1
 
DATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESDATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESsuthi
 
Standard template library
Standard template libraryStandard template library
Standard template librarySukriti Singh
 
Introduction to data structures (ss)
Introduction to data structures (ss)Introduction to data structures (ss)
Introduction to data structures (ss)Madishetty Prathibha
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structureadeel hamid
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data StructureJazz Jinia Bhowmik
 
Data Structure the Basic Structure for Programming
Data Structure the Basic Structure for ProgrammingData Structure the Basic Structure for Programming
Data Structure the Basic Structure for Programmingpaperpublications3
 
Data structure power point presentation
Data structure power point presentation Data structure power point presentation
Data structure power point presentation Anil Kumar Prajapati
 
46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.pptRizwanBasha12
 
Data structure
Data structureData structure
Data structuresnaya
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfAxmedcarb
 
Data Structure
Data Structure Data Structure
Data Structure Ibrahim MH
 

Similar a Data_structure.pptx (20)

Data structure & algorithms introduction
Data structure & algorithms introductionData structure & algorithms introduction
Data structure & algorithms introduction
 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptx
 
DATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESDATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTES
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Introduction to data structures (ss)
Introduction to data structures (ss)Introduction to data structures (ss)
Introduction to data structures (ss)
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Ch1
Ch1Ch1
Ch1
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
 
Data structure and its types.
Data structure and its types.Data structure and its types.
Data structure and its types.
 
Datastructures Notes
Datastructures NotesDatastructures Notes
Datastructures Notes
 
Data Structure the Basic Structure for Programming
Data Structure the Basic Structure for ProgrammingData Structure the Basic Structure for Programming
Data Structure the Basic Structure for Programming
 
Data structure power point presentation
Data structure power point presentation Data structure power point presentation
Data structure power point presentation
 
46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt
 
Data structure
Data structureData structure
Data structure
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
Data Structure
Data Structure Data Structure
Data Structure
 
Types of datastructures
Types of datastructuresTypes of datastructures
Types of datastructures
 
1597380885789.ppt
1597380885789.ppt1597380885789.ppt
1597380885789.ppt
 
CSE 443 (1).pptx
CSE 443 (1).pptxCSE 443 (1).pptx
CSE 443 (1).pptx
 

Último

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Último (20)

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 

Data_structure.pptx

  • 2. What is Data Structure? A data structure is a way of organizing and storing data in a computer system or programming language. It provides a systematic way of managing and accessing data, allowing efficient operations such as insertion, deletion, searching, and retrieval.
  • 3. Classification of data structure Data structure Linear Data structure Static data structure Array Dynamic data structure Linked list Stack Queue Non-linear Data structure Tree Graph
  • 4. Linear Data Structure A linear data structure organizes and stores data where the elements form a linear sequence. Elements are accessed sequentially, typically one after another, with a clear first and last element. Examples of linear data structures include arrays, linked lists, stacks, and queues. Further classified as Static and Dynamic data structure. Static data structures have a fixed size and memory allocation, while dynamic data structures can grow or shrink in size during program execution. Arrays Linear Data structure Linked List Stack Queue
  • 5. Arrays Arrays are a fundamental data structure that stores a fixed-size sequence of elements of the same type. They provide a contiguous block of memory where elements are accessed using their indices. Arrays offer efficient random access and constant-time element retrieval and are suitable for situations where the collection size is known in advance or does not need to change dynamically. Let us discuss: • Characteristics of an array • Array operations • Applications 1 2 3 4 5 0 1 2 3 4 A1 100 101 102 103 104 1 2 3 4 A2 5 6 7 8 9 10 11 12 1 2 3 A3 4 6 7 8 7 10 11 12 11 12 13 14 6 7 8 17 10 11 12 21 22 23 24 25 26 27 28 29 1-D Array 2-D Array 3-D Array
  • 6. Characteristics of Array Index-based data structure Consists of homogeneous elements i.e. elements of the same data types Predetermined or fixed size Elements are stored at contiguous memory locations Random access to elements (as they can be accessed using their indices)
  • 7. Array Operations Accessing Elements: Direct access using the array[index] Searching: specific elements can be searched using Linear or Binary search. Sorting: can be sorted in ascending or descending order using bubble sort and quick sort algorithms. Insertion: elements can be inserted at a specific index by shifting existing elements. Deletion: elements can be removed from specific indices, and then gaps are filled by shifting the remaining elements Updating Elements: Array elements can be modified by assigning a new value to a specific index. 1 2 3 4 5 0 1 2 3 4 A1 8 8 is to be added at index 2. 1 2 8 3 4 0 1 2 3 4 A1 5 5 1 2 3 4 5 0 1 2 3 4 A1 Insertion Operation Deletion Operation
  • 8. Applications of Array Data storage and retrieval: Arrays order data. An array can hold student scores or weather station temperatures. Sorting: Arrays can sort data in ascending or descending order. Sorting algorithms such as bubble sort, merge sort, and quicksort rely heavily on arrays. Searching: Arrays can be searched for specific elements using linear and binary search algorithms. Stacks and queues: Arrays are the underlying data structure for implementing stacks and queues, commonly used in algorithms and data structures. Graphs: Arrays can be used to represent graphs in computer science. Each element in the array represents a node in the graph, and the relationships between the nodes are represented by the values stored in the array. Dynamic programming: Dynamic programming algorithms often use arrays to store intermediate results of subproblems to solve a more significant problem.
  • 9. Linked Lists A linked list is a dynamic data structure consisting of a sequence of nodes, where each node contains data and a reference (or link) to the next node. Linked lists can expand or shrink without contiguous memory allocation, unlike arrays. Linked lists are employed when the collection size changes often or when efficient insertion and deletion operations are needed. Types are: • Singly-linked lists • Doubly linked lists • Circular linked lists • Doubly circular linked lists Head Data Next Data Data Data Next Next Next NULL
  • 10. Types of Linked Lists 1.Singly Linked List: In a singly linked list, each node contains data and a reference (or link) to the next node. It allows traversal in only one direction, from the head (start) to the tail (end) of the list. 2. Doubly Linked List: Each node references the next and previous nodes in a doubly linked list. This allows for bidirectional traversal, enabling operations like traversal in both directions, insertion/deletion at both ends and reverse traversal.
  • 11. Types of Linked Lists 3. Circular Linked List: The last node's reference points back to the first node, forming a loop in a circular linked list. This allows for continuous traversal without a defined end. 4. Doubly Circular Linked List: A combination of a doubly linked list and circular linked list, this type has nodes with references to both the next and previous nodes and the last node's reference points back to the first node, forming a circular loop. It enables bidirectional traversal and continuous looping.
  • 12. Characteristics of Linked List Dynamic size: nodes can easily be inserted and deleted making the linked list dynamic in size. Non-contiguous memory: Each node in a linked list contains a reference to the next node, allowing for flexible memory allocation. Node Structure: Linked lists consist of individual nodes containing data and a reference (or link) to the next node in the sequence. This structure enables sequential traversal and manipulation of elements. Sequential access: Starting at the list head, linked lists sequentially access elements. Random access is not efficient. Dynamic Memory Allocation: Linked lists efficiently allocate memory as nodes are added. They can handle data of various sizes and changing needs due to their flexibility.
  • 13. Operations on Linked List Insertion: Nodes can be inserted at the beginning, end, or at a specific position within the linked list. Insertion involves creating a new node, adjusting the links, and updating the references of neighboring nodes. Deletion: Nodes can be removed from the linked list. Deletion involves updating the references of neighboring nodes to bypass the deleted node and freeing the memory occupied by the node. Traversal: Linked lists can be traversed sequentially to access or modify each element. Starting from the head node, each subsequent node is visited until the end of the list is reached. Searching: Linked lists can be searched for a specific value or element. It involves traversing the list and comparing the data in each node with the target value.
  • 14. Applications of Linked List Linked Lists are used to implement stacks and queues. It is used for the various representations of trees and graphs. It is used in dynamic memory allocation( linked list of free blocks). It is also used for performing arithmetic operations on long integers. It is used for finding paths in networks. In operating systems, they can be used in Memory management, process scheduling, and file systems. Linked lists can be used to improve the performance of algorithms that need to frequently insert or delete items from extensive collections of data.
  • 15. Stacks A stack is a linear data structure that follows the Last-In- First-Out (LIFO) principle. It can be visualized as a vertical stack of objects, where the last object placed on top is the first to be removed. The operations performed on a stack are: Push: It adds an element to the top of the stack, increasing its size. The new element becomes the top element. Pop: It removes the top element from the stack, reducing its size. The element that was below the top element becomes the new top element. Peek/Top: It retrieves the value of the top element without removing it. A B C D PUSH POP STACK
  • 16. Application of Stacks Function calls and recursion: Stacks are used by programming languages to manage function calls and recursive operations. Expression evaluation: Stacks are employed to evaluate arithmetic expressions, convert infix expressions to postfix or prefix notation, and perform postfix/prefix expression evaluation. Undo/Redo operations: Stacks can implement undo and redo functionality in applications, keeping track of previous states or actions. Backtracking and depth-first search: Stacks are utilized in algorithms that require backtracking or depth-first traversal, such as maze solving or tree traversal. Memory management: Stacks play a role in managing memory allocation and deallocation, specifically in the context of function calls and local variables.
  • 17. Queue A queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. It can be visualized as a horizontal line of objects, where the first object inserted is the first one to be removed. The operations performed on a queue are: Enqueue: It adds an element to the back (end) of the queue. The size of the queue increases, and the new element becomes the last element in the queue. Dequeue: It removes the element from the front (beginning) of the queue. The queue size decreases, and the element second in line becomes the new front element. Peek/Front: It retrieves the value of the front element without removing it.
  • 18. Application of Queue Process scheduling: Queues are used in operating systems to manage the scheduling of processes, ensuring fairness and orderly execution. Print spooling: Queues are utilized in print spoolers to manage print jobs in the order they were received. Task management: Queues can manage tasks in a multitasking environment, ensuring that tasks are executed sequentially. Breadth-first search: Queues are employed in algorithms like breadth-first search, where elements are explored in a level-by-level order. Buffering and synchronization: Queues can buff data between processes or threads, ensuring proper synchronization and communication.
  • 19. Tree A tree is a nonlinear hierarchical data structure composed of nodes. It is often visualized as an upside-down tree, with a single node called the root at the top and the remaining nodes arranged in levels or layers below. Trees have various types and variations, including: • Binary Tree: A binary tree is a tree in which each node can have at most two children, referred to as the left and right child. • Binary Search Tree (BST): A binary search tree is a binary tree that follows a specific ordering property. The value of the left child is less than the parent node, and the value of the right child is greater than or equal to the parent node.
  • 20. Tree Key concepts in trees include: • Nodes: Each element in a tree is called a node. Nodes may contain data or information. • Root: The root is the topmost node in the tree. It serves as the starting point for traversing the tree. • Parent and Child Nodes: Nodes in a tree can have relationships with other nodes. A node directly connected to another node is called its child, and the node it is connected to is called its parent. Each node can have multiple children. • Leaf Nodes: Leaf nodes, or terminal nodes, are nodes without children. They are located at the bottommost layer of the tree. • Siblings: Nodes that share the same parent are called siblings. • Subtree: A subtree is a portion of a tree consisting of a node and its descendants, including all its children, grandchildren, etc.
  • 21. Applications of Tree Trees find application in various areas, including: • File Systems: Trees represent the hierarchical structure of files and directories in file systems. • Database Systems: Tree structures like B-trees are used in database indexing and searching. • Hierarchical Representations: Trees can represent organizational hierarchies, family trees, or class hierarchies in object-oriented programming. • Decision-Making and Game Algorithms: Trees can model decision-making processes and game trees in artificial intelligence algorithms. • Network Routing: Trees are employed in network routing algorithms, such as spanning trees used in network topology.
  • 22. Graph A graph is a non-linear data structure that consists of a collection of nodes (vertices) connected by edges. It is a powerful data structure for representing relationships between objects. Graphs can be categorized into different types, including • Directed Graph (Digraph): A graph in which the edges have a specific direction, indicating a one-way relationship between nodes. • Undirected Graph: A graph in which the edges have no specific direction, indicating a bi-directional relationship between nodes. • Weighted Graph: A graph in which edges are assigned weights or costs to represent the relationships between nodes' strength, distance, or importance.
  • 23. Graph Key concepts in graphs include: • Nodes (Vertices): Nodes are the fundamental units of a graph and represent objects or entities. Each node can hold additional information, such as data or attributes. • Edges: Edges connect pairs of nodes and represent their relationships or connections. An edge can be directed (pointing from one node to another) or undirected (bi-directional). • Adjacency: An edge connecting two nodes is considered adjacent. • Weight: Edges can be assigned a weight or cost, indicating the strength, distance, or importance of the relationship between connected nodes. Weighted graphs are used in various algorithms, such as shortest-path algorithms. • Path: A path in a graph is a sequence of nodes connected by edges. It represents a route or sequence of connections between nodes.
  • 24. Applications of Graph Graphs find application in various areas, such as: Social Networks: Graphs are used to model social networks, where nodes represent individuals, and edges represent relationships or connections between them. Network Routing: Graphs are used to model and analyze network topologies for efficient routing and communication in computer networks. Recommendation Systems: Graphs are used to build recommendation systems that suggest items, connections, or content based on relationships and patterns within the graph. Web Crawling: Graphs represent and navigate the interconnected structure of web pages during web crawling and indexing. Transportation and Logistics: Graphs are used in route planning, optimizing transportation networks, and solving problems like the traveling salesman problem.