SlideShare a Scribd company logo
DATA STRUCTURES
The logical and mathematical model of a particular organization of data is called
data structure.
PRIMITIVE
Array:
Array is an ordered collection of items. It contains same data type.
Array is a static object i.e. no of item is fixed and is assigned by the
declaration of the array
Stack:
Stack is a ordered collection of items
It is a list of dynamic objects/ elements in which an element may be inserted
or deleted only at one end called top of the stack.
DS
PRIMITIVE NON PRIMITIVE
LINEAR NON
LINEAR
ARRAYS
STRUCTURE
LIST
STACKS
QUEUES
TREE
GRAPH
Elements are removed from a stack in the reverse order of that in which they are
inserted in the stack.
“Push”- to insert into the stack
“pop”- to delete an element from a stack.
Stacks are used to indicate the order of processing of data when certain steps of
the processing must be postponed until other conditions are fulfilled.
Follows LIFO
Elements are removed from a stack (pop) in the reverse order of that in which
they were inserted into the stack (push).
It may contain different data types
Integer to indicate the current stack top within the array.
Operations: push, pop.
Queue:
An ordered collection of items from which items may be deleted at one end
(front end) & items inserted at the other end (rear end).
It follows FIFO.
Priority Queue: priority queue is a data structure in which the intrinsic ordering
of the elements (numeric or alphabetic)
Linked list:
A linked list is a linear collection of data elements, called nodes, where the
linear order is given by pointers. Each node has two parts 1st part contain the
information of the element 2nd part contains the address of the next node in
the list.
double linked list:
It is a collection of data elements called nodes, where each node is divided into
three parts
i) An info field that contains the information stored in the node
ii) Left field that contain pointer to node on left side
iii) Right field that contain pointer to node on right side
Tree: It is used to represent data which has a hierarical relationship. It can
have any no. of children per node.
Binary tree: it can have max. 2 children per node.
LEFT SUCCESSOR RIGHT SUCCESSOR
A spanning tree is a tree associated with a network. All the nodes of the graph
appear on the tree once. A minimum spanning tree is a spanning tree organized
so that the total edge weight between nodes is minimized
Binary search tree:
The values in all nodes in the right subtree of a node are greater than the
node values.
AVL tree: An empty binary tree, is an AVL tree, a non empty binary T tree is a
AVL tree. If given, TL & TR to be the left & right subtrees of T & H(TL) &
H(TR) to be the height of the subtrees TL & TR respectively. TL & TR are AVL
trees &
| H(TL)- H(TR)| <=1 where { H(TL)- H(TR } is known as the balance factor. The
balance factor of a node can be either 0,1, or -1
B=-1
B=0 B=-1
50
40 60
()
70
R
T1 T2
B=0
Graph:
A+B ::: INFIX
+AB ::: PREFIX
AB+ ::: POSTFIX
Precedence order:
1. Exponential
2. Multiplication
3. Divison
4. Addition
5. Substraction
Operations done:
1. Insertion
2. Deletion
3. Display/traversing
4. Searching
5. Sorting
Bubble sort:
Compare 2 adjacent elements, adjust by swapping & compare next 2 elements.
Insertion sort:
1st
element will be considered as a total array & the rest would be considered as a 2nd
array & the adjustment is made by swapping.
2nd
step: take 1st
2 elements as the 1st
array & rest as 2nd
array.
Continue till the 2nd
array becomes null.
Selection sort:
Take the smallest element & place it in the 1st
position.
Then start from the 2nd
block & take the 2nd
smallest element
In each pass we store 2 variables.
Binary search:
Last index will be in high. 1st
index will be in low.
Middle index will be stored in mid=(low + high)/2 for low<=high
Merge sort:
Last index will be in high. 1st
index will be in low.
Middle index will be stored in mid=(low + high)/2 for low<=high
Quick sort:
Mid= a[(high +low)/2] =p0
We will start checking from the left side & we will compare with p0 element.
Towers of Hanoi
A B C
Moving the blocks, from peg A to peg C, the condition is that only one block can be
moved at a time.
TREE:
It is used in networking.
Binary tree:
A set of elements that is either empty or is portioned into 3 disjoint subset.
The 1st
subset contains a single element called “root of the tree”.
Each element is called “node of the tree”
ROOT
LEFT SUB TREE
A
B C
RIGHT SUB TREE
D F
PREDEESSOR
SIBBLINGS
S
E
D,E,F – LEAVE NODE, because they don’t have successor.
Different type of binary tree:
1. Strictly binary tree:
A non leave node has non empty left & right sub tree.
A node can contain max. 2 child.
2. Complete binary tree:
Each node will contain maximum no. of child.
A
B C
D E F G
H I J K L
M N O
MAX.
1
2
3
4
LEVEL
0
1
2
3
3. Almost binary tree:
All nodes are at its max. level except possibly the last level & all nodes at the last level
appear as far left as possible
A
B C
E F G

More Related Content

PPTX
Introduction of Data Structure
PPTX
Data structure
PDF
linked lists in data structures
PPTX
Insertion in singly linked list
PPTX
Double Linked List (Algorithm)
PPT
List Data Structure
PPTX
linked list in data structure
PPTX
Presentation on Data Structure
Introduction of Data Structure
Data structure
linked lists in data structures
Insertion in singly linked list
Double Linked List (Algorithm)
List Data Structure
linked list in data structure
Presentation on Data Structure

What's hot (20)

PPTX
Data structure day1
PPTX
Linked stacks and queues
PPTX
Linked list
PPTX
What is Link list? explained with animations
PPT
Introduction to data structure
PPTX
linked list in Data Structure, Simple and Easy Tutorial
PPTX
Linked list in Data Structure and Algorithm
PPTX
DATA STRUCTURE
PPT
Linked lists
PPTX
Linked list
PPTX
Introduction to data structure
PPT
Lecture 1 data structures and algorithms
PPTX
DATA STRUCTURE IN C LANGUAGE
PDF
Data structure
PPTX
single linked list
PPT
Lecture7
PDF
Java Linked List Tutorial | Edureka
PPTX
Data structure power point presentation
PDF
Introduction of data structures and algorithms
PPT
Data Structure and Algorithms Linked List
Data structure day1
Linked stacks and queues
Linked list
What is Link list? explained with animations
Introduction to data structure
linked list in Data Structure, Simple and Easy Tutorial
Linked list in Data Structure and Algorithm
DATA STRUCTURE
Linked lists
Linked list
Introduction to data structure
Lecture 1 data structures and algorithms
DATA STRUCTURE IN C LANGUAGE
Data structure
single linked list
Lecture7
Java Linked List Tutorial | Edureka
Data structure power point presentation
Introduction of data structures and algorithms
Data Structure and Algorithms Linked List
Ad

Similar to Data structures notes (20)

PPTX
DATA STRUCTURE INTRODUCITON FULL NOTES.pptx
PPTX
DATA STRUCTURES and its classifications.pptx
PPTX
DATA STRUCTURE and its fundamentals .pptx
PPT
Lecture 1 - Overview of Data Structure .ppt
PPT
Introduction to data structure by anil dutt
PPT
Data structure study material introduction
PPTX
Data Structures
PPTX
SIX WEEKS SUMMER TRAINING REPORT.pptx
PPTX
SEARCHING AND SORTING ALGORITHMS, TYPES OF SORTING
PPT
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
PPT
data structure programing language in c.ppt
PPT
Data Structures and Algorithm for Engineers.ppt
PPT
DATA STRUCTURES IN INFORMATION TECHNOLOGY
PPT
DSA theory all topics (summary) presentation
PPT
02-dataStructurePM and algortima for python.ppt
PPT
Basic Data Structure and its concepts details
PPT
PPTX
Basics of Data Structure in engineering courses
PPTX
data structures module I & II.pptx
DATA STRUCTURE INTRODUCITON FULL NOTES.pptx
DATA STRUCTURES and its classifications.pptx
DATA STRUCTURE and its fundamentals .pptx
Lecture 1 - Overview of Data Structure .ppt
Introduction to data structure by anil dutt
Data structure study material introduction
Data Structures
SIX WEEKS SUMMER TRAINING REPORT.pptx
SEARCHING AND SORTING ALGORITHMS, TYPES OF SORTING
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
data structure programing language in c.ppt
Data Structures and Algorithm for Engineers.ppt
DATA STRUCTURES IN INFORMATION TECHNOLOGY
DSA theory all topics (summary) presentation
02-dataStructurePM and algortima for python.ppt
Basic Data Structure and its concepts details
Basics of Data Structure in engineering courses
data structures module I & II.pptx
Ad

More from Upasana Talukdar (20)

PPTX
Large group intervention at airbus
PDF
Shine life insurance
PPTX
Ohio department of taxation case study
PDF
Oprah winfrey-charismatic leader
PPTX
Reliance vs big bazaar
PPTX
Case analysis of wal mart
PPTX
Key Account Management
PPTX
contract act
PPTX
PPTX
Real estate market
PPTX
interviews
DOCX
computer organization and architecture notes
PDF
How to use movie maker
DOCX
Html tags list
PPTX
Crytocurrency and bitcoins
PPTX
FISCAL POLICY
PPTX
Ben and jerry's CASE STUDY ORGANIZATIONAL DESIGN
DOCX
Dbms notes
DOCX
Java notes
PPTX
Mba in India 101
Large group intervention at airbus
Shine life insurance
Ohio department of taxation case study
Oprah winfrey-charismatic leader
Reliance vs big bazaar
Case analysis of wal mart
Key Account Management
contract act
Real estate market
interviews
computer organization and architecture notes
How to use movie maker
Html tags list
Crytocurrency and bitcoins
FISCAL POLICY
Ben and jerry's CASE STUDY ORGANIZATIONAL DESIGN
Dbms notes
Java notes
Mba in India 101

Recently uploaded (20)

PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Well-logging-methods_new................
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
PPT on Performance Review to get promotions
PPT
Project quality management in manufacturing
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
additive manufacturing of ss316l using mig welding
DOCX
573137875-Attendance-Management-System-original
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
OOP with Java - Java Introduction (Basics)
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
bas. eng. economics group 4 presentation 1.pptx
Geodesy 1.pptx...............................................
Lesson 3_Tessellation.pptx finite Mathematics
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CH1 Production IntroductoryConcepts.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
Well-logging-methods_new................
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPT on Performance Review to get promotions
Project quality management in manufacturing
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
additive manufacturing of ss316l using mig welding
573137875-Attendance-Management-System-original

Data structures notes

  • 1. DATA STRUCTURES The logical and mathematical model of a particular organization of data is called data structure. PRIMITIVE Array: Array is an ordered collection of items. It contains same data type. Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array Stack: Stack is a ordered collection of items It is a list of dynamic objects/ elements in which an element may be inserted or deleted only at one end called top of the stack. DS PRIMITIVE NON PRIMITIVE LINEAR NON LINEAR ARRAYS STRUCTURE LIST STACKS QUEUES TREE GRAPH
  • 2. Elements are removed from a stack in the reverse order of that in which they are inserted in the stack. “Push”- to insert into the stack “pop”- to delete an element from a stack. Stacks are used to indicate the order of processing of data when certain steps of the processing must be postponed until other conditions are fulfilled. Follows LIFO Elements are removed from a stack (pop) in the reverse order of that in which they were inserted into the stack (push). It may contain different data types Integer to indicate the current stack top within the array. Operations: push, pop. Queue: An ordered collection of items from which items may be deleted at one end (front end) & items inserted at the other end (rear end). It follows FIFO. Priority Queue: priority queue is a data structure in which the intrinsic ordering of the elements (numeric or alphabetic) Linked list: A linked list is a linear collection of data elements, called nodes, where the linear order is given by pointers. Each node has two parts 1st part contain the information of the element 2nd part contains the address of the next node in the list. double linked list: It is a collection of data elements called nodes, where each node is divided into three parts i) An info field that contains the information stored in the node
  • 3. ii) Left field that contain pointer to node on left side iii) Right field that contain pointer to node on right side Tree: It is used to represent data which has a hierarical relationship. It can have any no. of children per node. Binary tree: it can have max. 2 children per node. LEFT SUCCESSOR RIGHT SUCCESSOR A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized Binary search tree: The values in all nodes in the right subtree of a node are greater than the node values. AVL tree: An empty binary tree, is an AVL tree, a non empty binary T tree is a AVL tree. If given, TL & TR to be the left & right subtrees of T & H(TL) & H(TR) to be the height of the subtrees TL & TR respectively. TL & TR are AVL trees & | H(TL)- H(TR)| <=1 where { H(TL)- H(TR } is known as the balance factor. The balance factor of a node can be either 0,1, or -1 B=-1 B=0 B=-1 50 40 60 () 70 R T1 T2
  • 4. B=0 Graph: A+B ::: INFIX +AB ::: PREFIX AB+ ::: POSTFIX Precedence order: 1. Exponential 2. Multiplication 3. Divison 4. Addition 5. Substraction
  • 5. Operations done: 1. Insertion 2. Deletion 3. Display/traversing 4. Searching 5. Sorting Bubble sort: Compare 2 adjacent elements, adjust by swapping & compare next 2 elements. Insertion sort: 1st element will be considered as a total array & the rest would be considered as a 2nd array & the adjustment is made by swapping. 2nd step: take 1st 2 elements as the 1st array & rest as 2nd array. Continue till the 2nd array becomes null. Selection sort: Take the smallest element & place it in the 1st position. Then start from the 2nd block & take the 2nd smallest element In each pass we store 2 variables. Binary search: Last index will be in high. 1st index will be in low. Middle index will be stored in mid=(low + high)/2 for low<=high Merge sort: Last index will be in high. 1st index will be in low. Middle index will be stored in mid=(low + high)/2 for low<=high Quick sort: Mid= a[(high +low)/2] =p0 We will start checking from the left side & we will compare with p0 element. Towers of Hanoi
  • 6. A B C Moving the blocks, from peg A to peg C, the condition is that only one block can be moved at a time. TREE: It is used in networking. Binary tree: A set of elements that is either empty or is portioned into 3 disjoint subset. The 1st subset contains a single element called “root of the tree”. Each element is called “node of the tree” ROOT LEFT SUB TREE A B C RIGHT SUB TREE D F PREDEESSOR SIBBLINGS S E
  • 7. D,E,F – LEAVE NODE, because they don’t have successor. Different type of binary tree: 1. Strictly binary tree: A non leave node has non empty left & right sub tree. A node can contain max. 2 child. 2. Complete binary tree: Each node will contain maximum no. of child. A B C D E F G H I J K L M N O MAX. 1 2 3 4 LEVEL 0 1 2 3
  • 8. 3. Almost binary tree: All nodes are at its max. level except possibly the last level & all nodes at the last level appear as far left as possible A B C E F G