SlideShare a Scribd company logo
1 of 9
SMART UNION ALGORITHMS
s.Paranipushpa
Department of CS &IT
Nadar saraswathi college of arts and science
 Algorithm is a step-by-step procedure, which defines a set of instructions to be
executed in a certain order to get the desired output. Algorithms are generally
created independent of underlying languages, i.e. an algorithm can be
implemented in more than one programming language.
 From the data structure point of view, following are some important categories
of algorithms −
 Search − Algorithm to search an item in a data structure.
 Sort − Algorithm to sort items in a certain order.
 Insert − Algorithm to insert item in a data structure.
 Update − Algorithm to update an existing item in a data structure.
 Delete − Algorithm to delete an existing item from a data structure.
APPLICATION AND ALGORITHMS
 Hash Table is a data structure which stores data in an
associative manner. In a hash table, data is stored in
an array format, where each data value has its own
unique index value. Access of data becomes very fast
if we know the index of the desired data.
 Thus, it becomes a data structure in which insertion
and search operations are very fast irrespective of the
size of the data. Hash Table uses an array as a storage
medium and uses hash technique to generate an
index where an element is to be inserted or is to be
located from.
HASH TABLE
 Hashing is a technique to convert a range of key
values into a range of indexes of an array. We're
going to use modulo operator to get a range of key
values. Consider an example of hash table of size 20,
and the following items are to be stored. Item are in
the (key,value) format.
 (1,20)
 (2,70)
 (42,80)
HASHING
 Following are the basic primary operations of a hash table.
 Search − Searches an element in a hash table.
 Insert − inserts an element in a hash table.
 delete − Deletes an element from a hash table.
 DataItem
 Define a data item having some data and key, based on which
the search is to be conducted in a hash table.
 struct DataItem { int data; int key; }; Hash Method
 Define a hashing method to compute the hash code of the key
of the data item.
 int hash Code(int key){ return key % SIZE; }Search Operation

BASIC OPERATION
 Mathematical graphs can be represented in data structure. We can represent a
graph using an array of vertices and a two-dimensional array of edges. Before we
proceed further, let's familiarize ourselves with some important terms −
 Vertex − Each node of the graph is represented as a vertex. In the following
example, the labeled circle represents vertices. Thus, A to G are vertices. We can
represent them using an array as shown in the following image. Here A can be
identified by index 0. B can be identified using index 1 and so on.
 Edge − Edge represents a path between two vertices or a line between two vertices.
In the following example, the lines from A to B, B to C, and so on represents
edges. We can use a two-dimensional array to represent an array as shown in the
following image. Here AB can be represented as 1 at row 0, column 1, BC as 1 at
row 1, column 2 and so on, keeping other combinations as 0.
 Adjacency − Two node or vertices are adjacent if they are connected to each other
through an edge. In the following example, B is adjacent to A, C is adjacent to B,
and so on.
GRAPH AND DATA STRUCTURE
AVL ROTATION:
 To balance itself, an AVL tree may perform the following four kinds of rotations −
 Left rotation
 Right rotation
 Left-Right rotation
 Right-Left rotation
 The first two rotations are single rotations and the next two rotations are double rotations. To have an
unbalanced tree, we at least need a tree of height 2. With this simple tree, let's understand them one by
one.
 Left Rotation
 If a tree becomes unbalanced, when a node is inserted into the right sub tree of the right sub tree, then we
perform a single left rotation −
 In our example, node A has become unbalanced as a node is inserted in the right sub tree of A's right sub
tree. We perform the left rotation by making A the left-sub tree of B.
 Right Rotation
AVL TREES
 Right Rotation
 AVL tree may become unbalanced, if a node is
inserted in the left sub tree of the left sub tree. The
tree then needs a right rotation.
 As depicted, the unbalanced node becomes the right
child of its left child by performing a right rotation.
AVL RIGHT ROTATION
AVL LEFT RIGHT ROTATION
Double rotations are slightly complex version of already
explained versions of rotations. To understand them better, we
should take note of each action performed while rotation. Let's
first check how to perform Left-Right rotation. A left-right
rotation is a combination of left rotation followed by right
rotation

More Related Content

What's hot

Line & Bar Graphs 97
Line & Bar Graphs 97Line & Bar Graphs 97
Line & Bar Graphs 97
herbison
 
Sienna 8 countingsorts
Sienna 8 countingsortsSienna 8 countingsorts
Sienna 8 countingsorts
chidabdu
 
Arrays
ArraysArrays
Arrays
uos
 
4.1 Matrix Operations (part 1)
4.1 Matrix Operations (part 1)4.1 Matrix Operations (part 1)
4.1 Matrix Operations (part 1)
hisema01
 
Interpreting charts and graphs
Interpreting charts and graphsInterpreting charts and graphs
Interpreting charts and graphs
lesliejohnson441
 
Data structure using c bcse 3102 pcs 1002
Data structure using c bcse 3102 pcs 1002Data structure using c bcse 3102 pcs 1002
Data structure using c bcse 3102 pcs 1002
SANTOSH RATH
 
Writing Figures, grap
Writing Figures, grapWriting Figures, grap
Writing Figures, grap
juvinmiscala
 

What's hot (20)

Line & Bar Graphs 97
Line & Bar Graphs 97Line & Bar Graphs 97
Line & Bar Graphs 97
 
Data structure day1
Data structure day1Data structure day1
Data structure day1
 
2.5
2.52.5
2.5
 
Sienna 8 countingsorts
Sienna 8 countingsortsSienna 8 countingsorts
Sienna 8 countingsorts
 
Graphing ppt
Graphing pptGraphing ppt
Graphing ppt
 
Sorting algorithms in Data Structure
Sorting algorithms in Data StructureSorting algorithms in Data Structure
Sorting algorithms in Data Structure
 
Graphs
GraphsGraphs
Graphs
 
Making a Pie Chart
Making a Pie ChartMaking a Pie Chart
Making a Pie Chart
 
Arrays
ArraysArrays
Arrays
 
4.1 Matrix Operations (part 1)
4.1 Matrix Operations (part 1)4.1 Matrix Operations (part 1)
4.1 Matrix Operations (part 1)
 
Graphing
GraphingGraphing
Graphing
 
Graphing ppt
Graphing pptGraphing ppt
Graphing ppt
 
Grade 11, U0-L3-Graphing
Grade 11, U0-L3-GraphingGrade 11, U0-L3-Graphing
Grade 11, U0-L3-Graphing
 
Interpreting charts and graphs
Interpreting charts and graphsInterpreting charts and graphs
Interpreting charts and graphs
 
Data structure
Data structureData structure
Data structure
 
Bar chart
Bar chartBar chart
Bar chart
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Data structure using c bcse 3102 pcs 1002
Data structure using c bcse 3102 pcs 1002Data structure using c bcse 3102 pcs 1002
Data structure using c bcse 3102 pcs 1002
 
Writing Figures, grap
Writing Figures, grapWriting Figures, grap
Writing Figures, grap
 
AVL Tree
AVL Tree  AVL Tree
AVL Tree
 

Similar to Smart.ppt

PYTHON ALGORITHMS, DATA STRUCTURE, SORTING TECHNIQUES
PYTHON ALGORITHMS, DATA STRUCTURE, SORTING TECHNIQUESPYTHON ALGORITHMS, DATA STRUCTURE, SORTING TECHNIQUES
PYTHON ALGORITHMS, DATA STRUCTURE, SORTING TECHNIQUES
vanithasivdc
 
DS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and EngineeringDS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and Engineering
RAJASEKHARV8
 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
yarotos643
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Malikireddy Bramhananda Reddy
 
1.Introduction to Data Structures and Algorithms.pptx
1.Introduction to Data Structures and Algorithms.pptx1.Introduction to Data Structures and Algorithms.pptx
1.Introduction to Data Structures and Algorithms.pptx
BlueSwede
 
data structure details of types and .ppt
data structure details of types and .pptdata structure details of types and .ppt
data structure details of types and .ppt
poonamsngr
 
data structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptxdata structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptx
coc7987515756
 

Similar to Smart.ppt (20)

PYTHON ALGORITHMS, DATA STRUCTURE, SORTING TECHNIQUES
PYTHON ALGORITHMS, DATA STRUCTURE, SORTING TECHNIQUESPYTHON ALGORITHMS, DATA STRUCTURE, SORTING TECHNIQUES
PYTHON ALGORITHMS, DATA STRUCTURE, SORTING TECHNIQUES
 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptx
 
DSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notesDSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notes
 
DS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and EngineeringDS Complete notes for Computer science and Engineering
DS Complete notes for Computer science and Engineering
 
General Data structures
General Data structuresGeneral Data structures
General Data structures
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
 
data structure programing language in c.ppt
data structure programing language in c.pptdata structure programing language in c.ppt
data structure programing language in c.ppt
 
1.Introduction to Data Structures and Algorithms.pptx
1.Introduction to Data Structures and Algorithms.pptx1.Introduction to Data Structures and Algorithms.pptx
1.Introduction to Data Structures and Algorithms.pptx
 
1597380885789.ppt
1597380885789.ppt1597380885789.ppt
1597380885789.ppt
 
data structure details of types and .ppt
data structure details of types and .pptdata structure details of types and .ppt
data structure details of types and .ppt
 
data structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptxdata structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptx
 
Data Structure
Data StructureData Structure
Data Structure
 
intr_ds.ppt
intr_ds.pptintr_ds.ppt
intr_ds.ppt
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptx
 
PM.ppt
PM.pptPM.ppt
PM.ppt
 
Data structures - unit 1
Data structures - unit 1Data structures - unit 1
Data structures - unit 1
 
PM.ppt
PM.pptPM.ppt
PM.ppt
 

More from amuthadeepa (12)

Edgelinking
EdgelinkingEdgelinking
Edgelinking
 
Handover
HandoverHandover
Handover
 
Handover
HandoverHandover
Handover
 
Cookies
CookiesCookies
Cookies
 
Critical system
Critical systemCritical system
Critical system
 
Excellencein visualization
Excellencein visualizationExcellencein visualization
Excellencein visualization
 
Protocol.ppt
Protocol.pptProtocol.ppt
Protocol.ppt
 
Datacleaning.ppt
Datacleaning.pptDatacleaning.ppt
Datacleaning.ppt
 
Datacleaning.ppt
Datacleaning.pptDatacleaning.ppt
Datacleaning.ppt
 
Database.ppt
Database.pptDatabase.ppt
Database.ppt
 
Network security.ppt
Network security.pptNetwork security.ppt
Network security.ppt
 
Perceptron.ppt
Perceptron.pptPerceptron.ppt
Perceptron.ppt
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 

Smart.ppt

  • 1. SMART UNION ALGORITHMS s.Paranipushpa Department of CS &IT Nadar saraswathi college of arts and science
  • 2.  Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output. Algorithms are generally created independent of underlying languages, i.e. an algorithm can be implemented in more than one programming language.  From the data structure point of view, following are some important categories of algorithms −  Search − Algorithm to search an item in a data structure.  Sort − Algorithm to sort items in a certain order.  Insert − Algorithm to insert item in a data structure.  Update − Algorithm to update an existing item in a data structure.  Delete − Algorithm to delete an existing item from a data structure. APPLICATION AND ALGORITHMS
  • 3.  Hash Table is a data structure which stores data in an associative manner. In a hash table, data is stored in an array format, where each data value has its own unique index value. Access of data becomes very fast if we know the index of the desired data.  Thus, it becomes a data structure in which insertion and search operations are very fast irrespective of the size of the data. Hash Table uses an array as a storage medium and uses hash technique to generate an index where an element is to be inserted or is to be located from. HASH TABLE
  • 4.  Hashing is a technique to convert a range of key values into a range of indexes of an array. We're going to use modulo operator to get a range of key values. Consider an example of hash table of size 20, and the following items are to be stored. Item are in the (key,value) format.  (1,20)  (2,70)  (42,80) HASHING
  • 5.  Following are the basic primary operations of a hash table.  Search − Searches an element in a hash table.  Insert − inserts an element in a hash table.  delete − Deletes an element from a hash table.  DataItem  Define a data item having some data and key, based on which the search is to be conducted in a hash table.  struct DataItem { int data; int key; }; Hash Method  Define a hashing method to compute the hash code of the key of the data item.  int hash Code(int key){ return key % SIZE; }Search Operation  BASIC OPERATION
  • 6.  Mathematical graphs can be represented in data structure. We can represent a graph using an array of vertices and a two-dimensional array of edges. Before we proceed further, let's familiarize ourselves with some important terms −  Vertex − Each node of the graph is represented as a vertex. In the following example, the labeled circle represents vertices. Thus, A to G are vertices. We can represent them using an array as shown in the following image. Here A can be identified by index 0. B can be identified using index 1 and so on.  Edge − Edge represents a path between two vertices or a line between two vertices. In the following example, the lines from A to B, B to C, and so on represents edges. We can use a two-dimensional array to represent an array as shown in the following image. Here AB can be represented as 1 at row 0, column 1, BC as 1 at row 1, column 2 and so on, keeping other combinations as 0.  Adjacency − Two node or vertices are adjacent if they are connected to each other through an edge. In the following example, B is adjacent to A, C is adjacent to B, and so on. GRAPH AND DATA STRUCTURE
  • 7. AVL ROTATION:  To balance itself, an AVL tree may perform the following four kinds of rotations −  Left rotation  Right rotation  Left-Right rotation  Right-Left rotation  The first two rotations are single rotations and the next two rotations are double rotations. To have an unbalanced tree, we at least need a tree of height 2. With this simple tree, let's understand them one by one.  Left Rotation  If a tree becomes unbalanced, when a node is inserted into the right sub tree of the right sub tree, then we perform a single left rotation −  In our example, node A has become unbalanced as a node is inserted in the right sub tree of A's right sub tree. We perform the left rotation by making A the left-sub tree of B.  Right Rotation AVL TREES
  • 8.  Right Rotation  AVL tree may become unbalanced, if a node is inserted in the left sub tree of the left sub tree. The tree then needs a right rotation.  As depicted, the unbalanced node becomes the right child of its left child by performing a right rotation. AVL RIGHT ROTATION
  • 9. AVL LEFT RIGHT ROTATION Double rotations are slightly complex version of already explained versions of rotations. To understand them better, we should take note of each action performed while rotation. Let's first check how to perform Left-Right rotation. A left-right rotation is a combination of left rotation followed by right rotation