SlideShare a Scribd company logo
S O R T I N G A lecture by   ABDUL GHAFFAR  Chapter 3  Of  Reference  #1
Reference Books ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Contents ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],link2
Selection Sort  ( Ref # 2- 9.4) ,[object Object],[object Object],[object Object]
Selection Sort  (continue..)
Insertion Sort  (Ref #1-7.2,  Ref  2- 9.3)
Insertion Sort  (continue..)
Insertion Sort  (continue..)
Insertion Sort  (continue..)
Merge Sort  (Ref # 1- 7.6, Ref #2-8,9.6) ,[object Object]
Merge Sort  (continue..) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Merge Sort  (continue..)
Merge Sort  (continue..) Implementation in C++
Merge Sort  (continue..) Implementation in C++ Merging The Merge function of the TwoWayMergeSorter<T> class is defined in Program    . Altogether, this function takes four parameters: The first is a reference to the array to be sorted. The remaining three, left, middle, and right, are unsigned integers. It is assumed that  Furthermore, it is assumed that the two subsequences of the array,  and  are both sorted. The Merge routine merges the two sorted subsequences using the temporary array specified by tempArray. It then copies the merged (and sorted) sequence into the array at
Merge Sort  (continue..) Implementation in C++
Merge Sort  (continue..) Implementation in C++
Quick Sort ( Ref #1-7.x, Ref#2-x,y) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Quick Sort  ( Continue… ) ,[object Object],[object Object],[object Object]
Quick Sort  ( Continue… ) ,[object Object],[object Object],Example
Quick Sort  ( Continue… ) Example
Quick Sort  ( Continue… ) Example
Quick Sort  ( Continue… ) ,[object Object],[object Object],[object Object],[object Object],Implementation in C
Quick Sort  ( Continue… ) Implementation in C
Heap Sort ( Ref #1-7.7,  Ref #2 -9.10) ,[object Object],[object Object],[object Object]
Heap Sort  (Continue..) ,[object Object],[object Object]
Heap Sort  (Continue..) Array representation of Binary Tree
Heap Sort  (Continue..) ,[object Object],[object Object]
Heap Sort  (Continue..) ,[object Object],[object Object],[object Object],[object Object]
Heap Sort  (Continue..) ,[object Object]
Heap Sort  (Continue..) ,[object Object]
Heap Sort  (Continue..) ,[object Object],[object Object],[object Object],[object Object]
Heap Sort  (Continue..)  Building a heap
Heap Sort  (Continue..)  Building a heap
Heap Sort  (Continue..)  Building a heap The Algorithm
Heap Sort  (Continue..) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Heap Sort  (Continue..) Deleting the Root, an Example
Heap Sort  (Continue..)    Deleting the root (Algorithm)
Heap Sort  (Continue..)    Application algorithm
Heap Sort  (Continue..)  Implementation in C++
Heap Sort  (Continue..)  Implementation in C++
Heap Sort  (Continue..)  Implementation in C++
Heap Sort  (Continue..)  Implementation in C++
Heap Sort  (Continue..)  Implementation in C++
Heap Sort  (Continue..)  Implementation in C++ The Sorting Phase : Once the max heap has been built, heapsort proceeds to the sorting phase.b The sorting phase of heapsort works like this: We repeatedly swap the largest element in the heap (always in position 1) into the next position of the sorted sequence. After each such swap, there is a new value at the root of the heap and this new value is pushed down into the correct  position in the heap using the Percolate  Down routine.
Heap Sort  (Continue..)  Implementation in C++ The Sorting Phase : The next example explains this phase
Heap Sort  (Continue..)  Example
Heap Sort  (Continue..)  Example
Heap Sort  (Continue..)  Example
Heap Sort  (Continue..)  Example
External Sort
External Sort  (continue…)
External Sort  (continue…)

More Related Content

What's hot

Data Structure and Algorithms Merge Sort
Data Structure and Algorithms Merge SortData Structure and Algorithms Merge Sort
Data Structure and Algorithms Merge Sort
ManishPrajapati78
 
3.6 radix sort
3.6 radix sort3.6 radix sort
3.6 radix sort
Krish_ver2
 
Searching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data StructureSearching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data Structure
Balwant Gorad
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
almaqboli
 
Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)
Flynce Miguel
 
Bubble sort | Data structure |
Bubble sort | Data structure |Bubble sort | Data structure |
Bubble sort | Data structure |
MdSaiful14
 
Quick sort
Quick sortQuick sort
Quick sort
Uma mohan
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Pranay Neema
 
Quick sort
Quick sortQuick sort
Quick sort
Dhruv Sabalpara
 
Selection sort algorithm presentation, selection sort example using power point
Selection sort algorithm presentation, selection sort example using power point Selection sort algorithm presentation, selection sort example using power point
Selection sort algorithm presentation, selection sort example using power point
University of Science and Technology Chitttagong
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structures
DurgaDeviCbit
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
SHAKOOR AB
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
University of Science and Technology Chitttagong
 
Queue
QueueQueue
Queue
Raj Sarode
 
Insertion Sort
Insertion SortInsertion Sort
Insertion Sort
Brett Duncan
 
Lecture 07 Data Structures - Basic Sorting
Lecture 07 Data Structures - Basic SortingLecture 07 Data Structures - Basic Sorting
Lecture 07 Data Structures - Basic SortingHaitham El-Ghareeb
 
Radix sort presentation
Radix sort presentationRadix sort presentation
Radix sort presentation
Ratul Hasan
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
Meghaj Mallick
 
Insertion sort
Insertion sort Insertion sort
Insertion sort
Monalisa Patel
 

What's hot (20)

Data Structure and Algorithms Merge Sort
Data Structure and Algorithms Merge SortData Structure and Algorithms Merge Sort
Data Structure and Algorithms Merge Sort
 
3.6 radix sort
3.6 radix sort3.6 radix sort
3.6 radix sort
 
Searching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data StructureSearching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data Structure
 
Heap tree
Heap treeHeap tree
Heap tree
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)
 
Bubble sort | Data structure |
Bubble sort | Data structure |Bubble sort | Data structure |
Bubble sort | Data structure |
 
Quick sort
Quick sortQuick sort
Quick sort
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Quick sort
Quick sortQuick sort
Quick sort
 
Selection sort algorithm presentation, selection sort example using power point
Selection sort algorithm presentation, selection sort example using power point Selection sort algorithm presentation, selection sort example using power point
Selection sort algorithm presentation, selection sort example using power point
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structures
 
Hashing Technique In Data Structures
Hashing Technique In Data StructuresHashing Technique In Data Structures
Hashing Technique In Data Structures
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
 
Queue
QueueQueue
Queue
 
Insertion Sort
Insertion SortInsertion Sort
Insertion Sort
 
Lecture 07 Data Structures - Basic Sorting
Lecture 07 Data Structures - Basic SortingLecture 07 Data Structures - Basic Sorting
Lecture 07 Data Structures - Basic Sorting
 
Radix sort presentation
Radix sort presentationRadix sort presentation
Radix sort presentation
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Insertion sort
Insertion sort Insertion sort
Insertion sort
 

Similar to Sorting

Advanced s and s algorithm.ppt
Advanced s and s algorithm.pptAdvanced s and s algorithm.ppt
Advanced s and s algorithm.ppt
LegesseSamuel
 
data structures and algorithms Unit 3
data structures and algorithms Unit 3data structures and algorithms Unit 3
data structures and algorithms Unit 3
infanciaj
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
maamir farooq
 
VCE Unit 04vv.pptx
VCE Unit 04vv.pptxVCE Unit 04vv.pptx
VCE Unit 04vv.pptx
skilljiolms
 
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
Tosin Amuda
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
skilljiolms
 
Sorting2
Sorting2Sorting2
Sorting2
Saurabh Mishra
 
Sorting
SortingSorting
Sorting
BHARATH KUMAR
 
Selection sort
Selection sortSelection sort
Selection sortasra khan
 
Sorting
SortingSorting
lecture-k-sorting.ppt
lecture-k-sorting.pptlecture-k-sorting.ppt
lecture-k-sorting.ppt
SushantRaj25
 
3.ppt
3.ppt3.ppt
Lecture k-sorting
Lecture k-sortingLecture k-sorting
Lecture k-sorting
Vijayaraj Raj
 
Dsa – data structure and algorithms sorting
Dsa – data structure and algorithms  sortingDsa – data structure and algorithms  sorting
Dsa – data structure and algorithms sorting
sajinis3
 
Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0
BG Java EE Course
 
Address calculation-sort
Address calculation-sortAddress calculation-sort
Address calculation-sort
Vasim Pathan
 
Chapter3.pptx
Chapter3.pptxChapter3.pptx
Chapter3.pptx
ASMAALWADEE2
 
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmInsersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
Ehsan Ehrari
 

Similar to Sorting (20)

Advanced s and s algorithm.ppt
Advanced s and s algorithm.pptAdvanced s and s algorithm.ppt
Advanced s and s algorithm.ppt
 
Heap, quick and merge sort
Heap, quick and merge sortHeap, quick and merge sort
Heap, quick and merge sort
 
data structures and algorithms Unit 3
data structures and algorithms Unit 3data structures and algorithms Unit 3
data structures and algorithms Unit 3
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
 
VCE Unit 04vv.pptx
VCE Unit 04vv.pptxVCE Unit 04vv.pptx
VCE Unit 04vv.pptx
 
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
An Experiment to Determine and Compare Practical Efficiency of Insertion Sort...
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
 
Sorting2
Sorting2Sorting2
Sorting2
 
Sorting
SortingSorting
Sorting
 
Selection sort
Selection sortSelection sort
Selection sort
 
Sorting
SortingSorting
Sorting
 
Unit6 C
Unit6 C Unit6 C
Unit6 C
 
lecture-k-sorting.ppt
lecture-k-sorting.pptlecture-k-sorting.ppt
lecture-k-sorting.ppt
 
3.ppt
3.ppt3.ppt
3.ppt
 
Lecture k-sorting
Lecture k-sortingLecture k-sorting
Lecture k-sorting
 
Dsa – data structure and algorithms sorting
Dsa – data structure and algorithms  sortingDsa – data structure and algorithms  sorting
Dsa – data structure and algorithms sorting
 
Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0Algorithms with-java-advanced-1.0
Algorithms with-java-advanced-1.0
 
Address calculation-sort
Address calculation-sortAddress calculation-sort
Address calculation-sort
 
Chapter3.pptx
Chapter3.pptxChapter3.pptx
Chapter3.pptx
 
Insersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in AlgoritmInsersion & Bubble Sort in Algoritm
Insersion & Bubble Sort in Algoritm
 

More from Ghaffar Khan

World is beautiful ... ...
World is beautiful ... ...World is beautiful ... ...
World is beautiful ... ...
Ghaffar Khan
 
My Presentation On Ajax
My Presentation On AjaxMy Presentation On Ajax
My Presentation On AjaxGhaffar Khan
 
How A Computer Works
How A Computer WorksHow A Computer Works
How A Computer WorksGhaffar Khan
 
Exponential and Logarthmic funtions
Exponential and Logarthmic funtionsExponential and Logarthmic funtions
Exponential and Logarthmic funtionsGhaffar Khan
 
Exponential and Logarthmic funtions (1)
Exponential and Logarthmic funtions (1)Exponential and Logarthmic funtions (1)
Exponential and Logarthmic funtions (1)Ghaffar Khan
 
Quadratic And Polinomial Function
Quadratic And Polinomial FunctionQuadratic And Polinomial Function
Quadratic And Polinomial FunctionGhaffar Khan
 
Quadratic And Polinomial Function
 Quadratic And Polinomial Function Quadratic And Polinomial Function
Quadratic And Polinomial FunctionGhaffar Khan
 
Exponentioal And Logarthmic Functions
 Exponentioal And Logarthmic Functions Exponentioal And Logarthmic Functions
Exponentioal And Logarthmic FunctionsGhaffar Khan
 
Introduction to Computer Networks
 Introduction to Computer Networks Introduction to Computer Networks
Introduction to Computer NetworksGhaffar Khan
 
Control Structures
Control StructuresControl Structures
Control StructuresGhaffar Khan
 
Computer Graphics Introduction
Computer Graphics IntroductionComputer Graphics Introduction
Computer Graphics IntroductionGhaffar Khan
 

More from Ghaffar Khan (20)

World is beautiful ... ...
World is beautiful ... ...World is beautiful ... ...
World is beautiful ... ...
 
My Presentation On Ajax
My Presentation On AjaxMy Presentation On Ajax
My Presentation On Ajax
 
How A Computer Works
How A Computer WorksHow A Computer Works
How A Computer Works
 
For Loop
For LoopFor Loop
For Loop
 
Exponential and Logarthmic funtions
Exponential and Logarthmic funtionsExponential and Logarthmic funtions
Exponential and Logarthmic funtions
 
Exponential and Logarthmic funtions (1)
Exponential and Logarthmic funtions (1)Exponential and Logarthmic funtions (1)
Exponential and Logarthmic funtions (1)
 
Functions
FunctionsFunctions
Functions
 
Quadratic And Polinomial Function
Quadratic And Polinomial FunctionQuadratic And Polinomial Function
Quadratic And Polinomial Function
 
Quadratic And Polinomial Function
 Quadratic And Polinomial Function Quadratic And Polinomial Function
Quadratic And Polinomial Function
 
Exponentioal And Logarthmic Functions
 Exponentioal And Logarthmic Functions Exponentioal And Logarthmic Functions
Exponentioal And Logarthmic Functions
 
Internet Protocol
Internet ProtocolInternet Protocol
Internet Protocol
 
Introduction to Computer Networks
 Introduction to Computer Networks Introduction to Computer Networks
Introduction to Computer Networks
 
Network Layer
Network LayerNetwork Layer
Network Layer
 
Control Structures
Control StructuresControl Structures
Control Structures
 
Input And Output
 Input And Output Input And Output
Input And Output
 
Surfaces
SurfacesSurfaces
Surfaces
 
Vector Tools
Vector ToolsVector Tools
Vector Tools
 
Drawing Tools
Drawing ToolsDrawing Tools
Drawing Tools
 
Drawing Figures
Drawing FiguresDrawing Figures
Drawing Figures
 
Computer Graphics Introduction
Computer Graphics IntroductionComputer Graphics Introduction
Computer Graphics Introduction
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

Sorting

  • 1. S O R T I N G A lecture by ABDUL GHAFFAR Chapter 3 Of Reference #1
  • 2.
  • 3.
  • 4.
  • 5. Selection Sort (continue..)
  • 6. Insertion Sort (Ref #1-7.2, Ref 2- 9.3)
  • 7. Insertion Sort (continue..)
  • 8. Insertion Sort (continue..)
  • 9. Insertion Sort (continue..)
  • 10.
  • 11.
  • 12. Merge Sort (continue..)
  • 13. Merge Sort (continue..) Implementation in C++
  • 14. Merge Sort (continue..) Implementation in C++ Merging The Merge function of the TwoWayMergeSorter<T> class is defined in Program  . Altogether, this function takes four parameters: The first is a reference to the array to be sorted. The remaining three, left, middle, and right, are unsigned integers. It is assumed that Furthermore, it is assumed that the two subsequences of the array, and are both sorted. The Merge routine merges the two sorted subsequences using the temporary array specified by tempArray. It then copies the merged (and sorted) sequence into the array at
  • 15. Merge Sort (continue..) Implementation in C++
  • 16. Merge Sort (continue..) Implementation in C++
  • 17.
  • 18.
  • 19.
  • 20. Quick Sort ( Continue… ) Example
  • 21. Quick Sort ( Continue… ) Example
  • 22.
  • 23. Quick Sort ( Continue… ) Implementation in C
  • 24.
  • 25.
  • 26. Heap Sort (Continue..) Array representation of Binary Tree
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. Heap Sort (Continue..) Building a heap
  • 33. Heap Sort (Continue..) Building a heap
  • 34. Heap Sort (Continue..) Building a heap The Algorithm
  • 35.
  • 36. Heap Sort (Continue..) Deleting the Root, an Example
  • 37. Heap Sort (Continue..) Deleting the root (Algorithm)
  • 38. Heap Sort (Continue..) Application algorithm
  • 39. Heap Sort (Continue..) Implementation in C++
  • 40. Heap Sort (Continue..) Implementation in C++
  • 41. Heap Sort (Continue..) Implementation in C++
  • 42. Heap Sort (Continue..) Implementation in C++
  • 43. Heap Sort (Continue..) Implementation in C++
  • 44. Heap Sort (Continue..) Implementation in C++ The Sorting Phase : Once the max heap has been built, heapsort proceeds to the sorting phase.b The sorting phase of heapsort works like this: We repeatedly swap the largest element in the heap (always in position 1) into the next position of the sorted sequence. After each such swap, there is a new value at the root of the heap and this new value is pushed down into the correct position in the heap using the Percolate Down routine.
  • 45. Heap Sort (Continue..) Implementation in C++ The Sorting Phase : The next example explains this phase
  • 46. Heap Sort (Continue..) Example
  • 47. Heap Sort (Continue..) Example
  • 48. Heap Sort (Continue..) Example
  • 49. Heap Sort (Continue..) Example
  • 51. External Sort (continue…)
  • 52. External Sort (continue…)