SlideShare una empresa de Scribd logo
1 de 115
Descargar para leer sin conexión
Analysis and Design of Algorithms
Sorting Algorithms II
Analysis and Design of Algorithms
Counting Sort
Radix Sort
Merge Sort
Analysis and Design of Algorithms
Counting Sort
Analysis and Design of Algorithms
Counting sort is a sorting technique based on keys
between a specific range. It works by counting the
number of objects having distinct key values (kind of
hashing). Then doing some arithmetic to calculate
the position of each object in the output sequence.
Analysis and Design of Algorithms
Algorithm:
 Step1: Create a count array to store the count of each unique
object
 Step2 : Modify count array by adding the previous number.
 Step3 : Create output array by decrease count array
Analysis and Design of Algorithms
 Example 1 Assume the following Array in range of 0 to 5:
1 4 3 2 3 5 2
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 0 0 0 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 0 0 0 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 0 0 0 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 0 0 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 0 0 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 0 0 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 0 0 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 0 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 0 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 0 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 1 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 1 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 0 1 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 1 1 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 1 1 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 1 2 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 1 2 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 1 2 1 0
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 1 2 1 1
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 1 2 1 1
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 1 2 1 1
Analysis and Design of Algorithms
 Create a count array to store the count of each unique object:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 2 2 1 1
Analysis and Design of Algorithms
 Modify count array by adding the previous number :
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 2 2 1 1
Analysis and Design of Algorithms
 Modify count array by adding the previous number :
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 2 2 1 1
Analysis and Design of Algorithms
 Modify count array by adding the previous number :
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 2 1 1
Analysis and Design of Algorithms
 Modify count array by adding the previous number :
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 5 1 1
Analysis and Design of Algorithms
 Modify count array by adding the previous number :
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 5 6 1
Analysis and Design of Algorithms
 Modify count array by adding the previous number :
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 5 6 7
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 5 6 7
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 5 6 7
1 2 3 4 5 6 7
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 5 6 7
1 2 3 4 5 6 7
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 5 6 7
1 2 3 4 5 6 7
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 1 3 5 6 7
1 2 3 4 5 6 7
1
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 5 6 7
1 2 3 4 5 6 7
1
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 5 6 7
1 2 3 4 5 6 7
1
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 5 5 7
1 2 3 4 5 6 7
1 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 5 5 7
1 2 3 4 5 6 7
1 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 5 5 7
1 2 3 4 5 6 7
1 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 5 5 7
1 2 3 4 5 6 7
1 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 4 5 7
1 2 3 4 5 6 7
1 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 4 5 7
1 2 3 4 5 6 7
1 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 4 5 7
1 2 3 4 5 6 7
1 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 3 4 5 7
1 2 3 4 5 6 7
1 2 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 4 5 7
1 2 3 4 5 6 7
1 2 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 4 5 7
1 2 3 4 5 6 7
1 2 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 4 5 7
1 2 3 4 5 6 7
1 2 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 4 5 7
1 2 3 4 5 6 7
1 2 3 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 3 5 7
1 2 3 4 5 6 7
1 2 3 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 3 5 7
1 2 3 4 5 6 7
1 2 3 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 3 5 7
1 2 3 4 5 6 7
1 2 3 3 4
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 3 5 7
1 2 3 4 5 6 7
1 2 3 3 4 5
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 3 5 6
1 2 3 4 5 6 7
1 2 3 3 4 5
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 3 5 6
1 2 3 4 5 6 7
1 2 3 3 4 5
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 3 5 6
1 2 3 4 5 6 7
1 2 3 3 4 5
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 2 3 5 6
1 2 3 4 5 6 7
1 2 2 3 3 4 5
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 1 3 5 6
1 2 3 4 5 6 7
1 2 2 3 3 4 5
Analysis and Design of Algorithms
 Output each object from the input sequence followed by
decreasing its count by 1:
1 4 3 2 3 5 2
0 1 2 3 4 5
0 0 1 3 5 6
1 2 3 4 5 6 7
1 2 2 3 3 4 5
Analysis and Design of Algorithms
 Array is now sorted
1 2 2 3 3 4 5
Analysis and Design of Algorithms
2 4 1 1 3
 Example 2:
0 1 2 3 4
0 2 1 1 1
0 2 3 4 5
2
Count
Range=[0-4]
Add
1 2 3 4 5
Output
0 1 2 3 4
0 2 2 4 5Reduce
0 1 2 3 4
2 4
1 2 3 4 5
Output
0 2 2 4 4Reduce
0 1 2 3 4
1 2 4
1 2 3 4 5
Output
0 1 2 4 4Reduce
0 1 2 3 4
1 1 2 4
1 2 3 4 5
Output
0 0 2 4 4Reduce
0 1 2 3 4
1 1 2 3 4
1 2 3 4 5
Output
1 1 2 3 4
1 2 3 4 5
Sorted
Analysis and Design of Algorithms
 Python
Code
Analysis and Design of Algorithms
Analysis and Design of Algorithms
Analysis and Design of Algorithms
 Time Complexity: O(n+k) where n is the number of elements in input
array, and k is the range of input.
 Example of worst case
 Range between 1 to 10K
10 5 10k 5k 200
Analysis and Design of Algorithms
Radix Sort
Analysis and Design of Algorithms
 Radix sort is an algorithm that sorts numbers by processing digits
of each number either starting from the least significant digit (LSD)
or starting from the most significant digit (MSD).
 The idea of Radix Sort is to do digit by digit sort starting from
least significant digit to most significant digit. Radix sort uses
counting sort as a subroutine to sort.
Analysis and Design of Algorithms
Algorithm:
 Step1: Take the least significant digit of each element
 Step2 : Sort the list of elements based on that digit
 Step3 : Repeat the sort with each more significant digit
Analysis and Design of Algorithms
 Assume the following Array:
170 45 75 90 802 24 2 66
Analysis and Design of Algorithms
 The Sorted list will appear after three steps
170 45 75 90 802 24 2 66
170 90 802 2 24 45 75 66
802 2 24 45 66 170 75 90
2 24 45 66 75 90 170 802
Analysis and Design of Algorithms
 Step1: Sorting by least significant digit (1s place)
170 45 75 90 802 24 2 66
170 90 802 2 24 45 75 66
Analysis and Design of Algorithms
 Step2: Sorting by next digit (10s place)
170 90 802 2 24 45 75 66
802 2 24 45 66 170 75 90
Analysis and Design of Algorithms
 Step3: Sorting by most significant digit (100s place)
802 2 24 45 66 170 75 90
2 24 45 66 75 90 170 802
Analysis and Design of Algorithms
 Array is now sorted
2 24 45 66 75 90 170 802
Analysis and Design of Algorithms
 Example 2
1 2 3
5 8 3
1 5 4
5 6 7
6 8 9
6 2 5
4 5 6
1 2 3
5 8 3
1 5 4
6 2 5
4 5 6
5 6 7
6 8 9
1 2 3
6 2 5
1 5 4
4 5 6
5 6 7
5 8 3
6 8 9
1 2 3
1 5 4
4 5 6
5 6 7
5 8 3
6 2 5
6 8 9
1s 10s 100s
Analysis and Design of Algorithms
Analysis and Design of Algorithms
 Python Code
Analysis and Design of Algorithms
 Python Code
Analysis and Design of Algorithms
Time Complexity: O(n+k/d) where n is the number
of elements in input array, k is the range of input,
and d is number of digits.
Analysis and Design of Algorithms
Merge Sort
Analysis and Design of Algorithms
 Merge Sort is a Divide and Conquer algorithm. It
divides input array in two halves, calls itself for the
two halves and then merges the two sorted halves.
Analysis and Design of Algorithms
Algorithm:
 Step1: Divide the list recursively into two halves until it can
no more be divided
 Step2 : Merge (Conquer) the smaller lists into new list in
sorted order
Analysis and Design of Algorithms
 Assume the following Array:
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Divide
85 24 63 45 17 31 96 50
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Divide
85 24 63 45 17 31 96 50
85 24 63 45 17 31 96 50
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Divide
85 24 63 45 17 31 96 50
85 24 63 45 17 31 96 50
85 24 63 45 17 31 96 50
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 85
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 85
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 85 45 63
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 85 45 63
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 85 45 63 17 31
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 85 45 63 17 31
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 85 45 63 17 31 50 96
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 85 45 63 17 31 50 96
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24
24 85 45 63 17 31 50 96
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 45
24 85 45 63 17 31 50 96
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 45 63
24 85 45 63 17 31 50 96
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 45 63 85
24 85 45 63 17 31 50 96
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
24 45 63 85 17 31 50 96
24 85 45 63 17 31 50 96
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Sort & Merge
17 24 31 45 50 63 85 96
24 45 63 85 17 31 50 96
24 85 45 63 17 31 50 96
85 24 63 45 17 31 96 50
Analysis and Design of Algorithms
 Array is now sorted
17 24 31 45 50 63 85 96
Analysis and Design of Algorithms
 Example 2
Analysis and Design of Algorithms
Analysis and Design of Algorithms
Analysis and Design of Algorithms
Analysis and Design of Algorithms
Time Complexity: O(n * log(n) )
Analysis and Design of Algorithms
facebook.com/mloey
mohamedloey@gmail.com
twitter.com/mloey
linkedin.com/in/mloey
mloey@fci.bu.edu.eg
mloey.github.io
Analysis and Design of Algorithms
www.YourCompany.com
© 2020 Companyname PowerPoint Business Theme. All Rights Reserved.
THANKS FOR
YOUR TIME

Más contenido relacionado

La actualidad más candente

Algorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to AlgorithmsAlgorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to AlgorithmsMohamed Loey
 
Selection sort
Selection sortSelection sort
Selection sortstella D
 
Data Structures - Searching & sorting
Data Structures - Searching & sortingData Structures - Searching & sorting
Data Structures - Searching & sortingKaushal Shah
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting AlgorithmsPranay Neema
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsDrishti Bhalla
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSGokul Hari
 
Linear Search
Linear SearchLinear Search
Linear SearchSWATHIR72
 
Data Structures - Lecture 8 [Sorting Algorithms]
Data Structures - Lecture 8 [Sorting Algorithms]Data Structures - Lecture 8 [Sorting Algorithms]
Data Structures - Lecture 8 [Sorting Algorithms]Muhammad Hammad Waseem
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm03446940736
 
Bubble sort
Bubble sortBubble sort
Bubble sortManek Ar
 

La actualidad más candente (20)

Algorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to AlgorithmsAlgorithms Lecture 1: Introduction to Algorithms
Algorithms Lecture 1: Introduction to Algorithms
 
Selection sort
Selection sortSelection sort
Selection sort
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Data Structures - Searching & sorting
Data Structures - Searching & sortingData Structures - Searching & sorting
Data Structures - Searching & sorting
 
Ppt bubble sort
Ppt bubble sortPpt bubble sort
Ppt bubble sort
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
 
Insertion Sort
Insertion SortInsertion Sort
Insertion Sort
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Binary search
Binary searchBinary search
Binary search
 
Linear Search
Linear SearchLinear Search
Linear Search
 
Master theorem
Master theoremMaster theorem
Master theorem
 
Searching algorithms
Searching algorithmsSearching algorithms
Searching algorithms
 
Data Structures - Lecture 8 [Sorting Algorithms]
Data Structures - Lecture 8 [Sorting Algorithms]Data Structures - Lecture 8 [Sorting Algorithms]
Data Structures - Lecture 8 [Sorting Algorithms]
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
 
Quick Sort
Quick SortQuick Sort
Quick Sort
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
sorting and its types
sorting and its typessorting and its types
sorting and its types
 

Destacado

Deep Learning - Overview of my work II
Deep Learning - Overview of my work IIDeep Learning - Overview of my work II
Deep Learning - Overview of my work IIMohamed Loey
 
Convolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep LearningConvolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep LearningMohamed Loey
 
Computer Security Lecture 7: RSA
Computer Security Lecture 7: RSAComputer Security Lecture 7: RSA
Computer Security Lecture 7: RSAMohamed Loey
 
PMP Lecture 1: Introduction to Project Management
PMP Lecture 1: Introduction to Project ManagementPMP Lecture 1: Introduction to Project Management
PMP Lecture 1: Introduction to Project ManagementMohamed Loey
 
Computer Security Lecture 5: Simplified Advanced Encryption Standard
Computer Security Lecture 5: Simplified Advanced Encryption StandardComputer Security Lecture 5: Simplified Advanced Encryption Standard
Computer Security Lecture 5: Simplified Advanced Encryption StandardMohamed Loey
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language Mohamed Loey
 

Destacado (6)

Deep Learning - Overview of my work II
Deep Learning - Overview of my work IIDeep Learning - Overview of my work II
Deep Learning - Overview of my work II
 
Convolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep LearningConvolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep Learning
 
Computer Security Lecture 7: RSA
Computer Security Lecture 7: RSAComputer Security Lecture 7: RSA
Computer Security Lecture 7: RSA
 
PMP Lecture 1: Introduction to Project Management
PMP Lecture 1: Introduction to Project ManagementPMP Lecture 1: Introduction to Project Management
PMP Lecture 1: Introduction to Project Management
 
Computer Security Lecture 5: Simplified Advanced Encryption Standard
Computer Security Lecture 5: Simplified Advanced Encryption StandardComputer Security Lecture 5: Simplified Advanced Encryption Standard
Computer Security Lecture 5: Simplified Advanced Encryption Standard
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language
 

Similar a Algorithms Lecture 5: Sorting Algorithms II

Basics in algorithms and data structure
Basics in algorithms and data structure Basics in algorithms and data structure
Basics in algorithms and data structure Eman magdy
 
Feature Selection for Document Ranking
Feature Selection for Document RankingFeature Selection for Document Ranking
Feature Selection for Document RankingAndrea Gigli
 
2.4 Lecture.pptx
2.4 Lecture.pptx2.4 Lecture.pptx
2.4 Lecture.pptxTDeutsch1
 
Splunk Enterprise for Information Security (Hands-On)
Splunk Enterprise for Information Security (Hands-On)                           Splunk Enterprise for Information Security (Hands-On)
Splunk Enterprise for Information Security (Hands-On) Splunk
 
How Computer Games Help Children Learn (Stockholm University Dept of Educatio...
How Computer Games Help Children Learn (Stockholm University Dept of Educatio...How Computer Games Help Children Learn (Stockholm University Dept of Educatio...
How Computer Games Help Children Learn (Stockholm University Dept of Educatio...dws1d
 
Optimizing Set-Similarity Join and Search with Different Prefix Schemes
Optimizing Set-Similarity Join and Search with Different Prefix SchemesOptimizing Set-Similarity Join and Search with Different Prefix Schemes
Optimizing Set-Similarity Join and Search with Different Prefix SchemesHPCC Systems
 
Lecture 10-cs648=2013 Randomized Algorithms
Lecture 10-cs648=2013 Randomized AlgorithmsLecture 10-cs648=2013 Randomized Algorithms
Lecture 10-cs648=2013 Randomized AlgorithmsAnshul Yadav
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac ToeSarthak Srivastava
 
Reducing Redundancies in Multi-Revision Code Analysis
Reducing Redundancies in Multi-Revision Code AnalysisReducing Redundancies in Multi-Revision Code Analysis
Reducing Redundancies in Multi-Revision Code AnalysisSebastiano Panichella
 
Real-time, real estate listings with Apache Kafka
Real-time, real estate listings with Apache KafkaReal-time, real estate listings with Apache Kafka
Real-time, real estate listings with Apache KafkaFerran Galí Reniu
 
Predicting Stock Market Returns and the Efficiency Market Hypothesis
Predicting Stock Market Returns and the Efficiency Market HypothesisPredicting Stock Market Returns and the Efficiency Market Hypothesis
Predicting Stock Market Returns and the Efficiency Market HypothesisMysa Vijay
 

Similar a Algorithms Lecture 5: Sorting Algorithms II (20)

Basics in algorithms and data structure
Basics in algorithms and data structure Basics in algorithms and data structure
Basics in algorithms and data structure
 
UNEC__1683196273.pptx
UNEC__1683196273.pptxUNEC__1683196273.pptx
UNEC__1683196273.pptx
 
Apriori algorithm
Apriori algorithmApriori algorithm
Apriori algorithm
 
Feature Selection for Document Ranking
Feature Selection for Document RankingFeature Selection for Document Ranking
Feature Selection for Document Ranking
 
Lecture6[1]
Lecture6[1]Lecture6[1]
Lecture6[1]
 
2.4 Lecture.pptx
2.4 Lecture.pptx2.4 Lecture.pptx
2.4 Lecture.pptx
 
Cis435 week06
Cis435 week06Cis435 week06
Cis435 week06
 
Splunk Enterprise for Information Security (Hands-On)
Splunk Enterprise for Information Security (Hands-On)                           Splunk Enterprise for Information Security (Hands-On)
Splunk Enterprise for Information Security (Hands-On)
 
How Computer Games Help Children Learn (Stockholm University Dept of Educatio...
How Computer Games Help Children Learn (Stockholm University Dept of Educatio...How Computer Games Help Children Learn (Stockholm University Dept of Educatio...
How Computer Games Help Children Learn (Stockholm University Dept of Educatio...
 
Encoder decoder
Encoder decoderEncoder decoder
Encoder decoder
 
Lec25
Lec25Lec25
Lec25
 
Optimizing Set-Similarity Join and Search with Different Prefix Schemes
Optimizing Set-Similarity Join and Search with Different Prefix SchemesOptimizing Set-Similarity Join and Search with Different Prefix Schemes
Optimizing Set-Similarity Join and Search with Different Prefix Schemes
 
Sorting
SortingSorting
Sorting
 
Data Mining Lecture_4.pptx
Data Mining Lecture_4.pptxData Mining Lecture_4.pptx
Data Mining Lecture_4.pptx
 
Lecture 10-cs648=2013 Randomized Algorithms
Lecture 10-cs648=2013 Randomized AlgorithmsLecture 10-cs648=2013 Randomized Algorithms
Lecture 10-cs648=2013 Randomized Algorithms
 
Data Structure (MC501)
Data Structure (MC501)Data Structure (MC501)
Data Structure (MC501)
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac Toe
 
Reducing Redundancies in Multi-Revision Code Analysis
Reducing Redundancies in Multi-Revision Code AnalysisReducing Redundancies in Multi-Revision Code Analysis
Reducing Redundancies in Multi-Revision Code Analysis
 
Real-time, real estate listings with Apache Kafka
Real-time, real estate listings with Apache KafkaReal-time, real estate listings with Apache Kafka
Real-time, real estate listings with Apache Kafka
 
Predicting Stock Market Returns and the Efficiency Market Hypothesis
Predicting Stock Market Returns and the Efficiency Market HypothesisPredicting Stock Market Returns and the Efficiency Market Hypothesis
Predicting Stock Market Returns and the Efficiency Market Hypothesis
 

Más de Mohamed Loey

Lecture 6: Deep Learning Applications
Lecture 6: Deep Learning ApplicationsLecture 6: Deep Learning Applications
Lecture 6: Deep Learning ApplicationsMohamed Loey
 
Lecture 5: Convolutional Neural Network Models
Lecture 5: Convolutional Neural Network ModelsLecture 5: Convolutional Neural Network Models
Lecture 5: Convolutional Neural Network ModelsMohamed Loey
 
Lecture 4: Deep Learning Frameworks
Lecture 4: Deep Learning FrameworksLecture 4: Deep Learning Frameworks
Lecture 4: Deep Learning FrameworksMohamed Loey
 
Lecture 4: How it Works: Convolutional Neural Networks
Lecture 4: How it Works: Convolutional Neural NetworksLecture 4: How it Works: Convolutional Neural Networks
Lecture 4: How it Works: Convolutional Neural NetworksMohamed Loey
 
Lecture 3: Convolutional Neural Networks
Lecture 3: Convolutional Neural NetworksLecture 3: Convolutional Neural Networks
Lecture 3: Convolutional Neural NetworksMohamed Loey
 
Lecture 2: Artificial Neural Network
Lecture 2: Artificial Neural NetworkLecture 2: Artificial Neural Network
Lecture 2: Artificial Neural NetworkMohamed Loey
 
Lecture 1: Deep Learning for Computer Vision
Lecture 1: Deep Learning for Computer VisionLecture 1: Deep Learning for Computer Vision
Lecture 1: Deep Learning for Computer VisionMohamed Loey
 
Design of an Intelligent System for Improving Classification of Cancer Diseases
Design of an Intelligent System for Improving Classification of Cancer DiseasesDesign of an Intelligent System for Improving Classification of Cancer Diseases
Design of an Intelligent System for Improving Classification of Cancer DiseasesMohamed Loey
 
Computer Security - CCNA Security - Lecture 2
Computer Security - CCNA Security - Lecture 2Computer Security - CCNA Security - Lecture 2
Computer Security - CCNA Security - Lecture 2Mohamed Loey
 
Computer Security - CCNA Security - Lecture 1
Computer Security - CCNA Security - Lecture 1Computer Security - CCNA Security - Lecture 1
Computer Security - CCNA Security - Lecture 1Mohamed Loey
 
Computer Security Lecture 4.1: DES Supplementary Material
Computer Security Lecture 4.1: DES Supplementary MaterialComputer Security Lecture 4.1: DES Supplementary Material
Computer Security Lecture 4.1: DES Supplementary MaterialMohamed Loey
 
PMP Lecture 4: Project Integration Management
PMP Lecture 4: Project Integration ManagementPMP Lecture 4: Project Integration Management
PMP Lecture 4: Project Integration ManagementMohamed Loey
 
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardComputer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardMohamed Loey
 
Computer Security Lecture 3: Classical Encryption Techniques 2
Computer Security Lecture 3: Classical Encryption Techniques 2Computer Security Lecture 3: Classical Encryption Techniques 2
Computer Security Lecture 3: Classical Encryption Techniques 2Mohamed Loey
 
Computer Security Lecture 2: Classical Encryption Techniques 1
Computer Security Lecture 2: Classical Encryption Techniques 1Computer Security Lecture 2: Classical Encryption Techniques 1
Computer Security Lecture 2: Classical Encryption Techniques 1Mohamed Loey
 
Computer Security Lecture 1: Overview
Computer Security Lecture 1: OverviewComputer Security Lecture 1: Overview
Computer Security Lecture 1: OverviewMohamed Loey
 
PMP Lecture 3: Project Management Processes
PMP Lecture 3: Project Management ProcessesPMP Lecture 3: Project Management Processes
PMP Lecture 3: Project Management ProcessesMohamed Loey
 
PMP Lecture 2: Project Management Framework
PMP Lecture 2: Project Management FrameworkPMP Lecture 2: Project Management Framework
PMP Lecture 2: Project Management FrameworkMohamed Loey
 

Más de Mohamed Loey (18)

Lecture 6: Deep Learning Applications
Lecture 6: Deep Learning ApplicationsLecture 6: Deep Learning Applications
Lecture 6: Deep Learning Applications
 
Lecture 5: Convolutional Neural Network Models
Lecture 5: Convolutional Neural Network ModelsLecture 5: Convolutional Neural Network Models
Lecture 5: Convolutional Neural Network Models
 
Lecture 4: Deep Learning Frameworks
Lecture 4: Deep Learning FrameworksLecture 4: Deep Learning Frameworks
Lecture 4: Deep Learning Frameworks
 
Lecture 4: How it Works: Convolutional Neural Networks
Lecture 4: How it Works: Convolutional Neural NetworksLecture 4: How it Works: Convolutional Neural Networks
Lecture 4: How it Works: Convolutional Neural Networks
 
Lecture 3: Convolutional Neural Networks
Lecture 3: Convolutional Neural NetworksLecture 3: Convolutional Neural Networks
Lecture 3: Convolutional Neural Networks
 
Lecture 2: Artificial Neural Network
Lecture 2: Artificial Neural NetworkLecture 2: Artificial Neural Network
Lecture 2: Artificial Neural Network
 
Lecture 1: Deep Learning for Computer Vision
Lecture 1: Deep Learning for Computer VisionLecture 1: Deep Learning for Computer Vision
Lecture 1: Deep Learning for Computer Vision
 
Design of an Intelligent System for Improving Classification of Cancer Diseases
Design of an Intelligent System for Improving Classification of Cancer DiseasesDesign of an Intelligent System for Improving Classification of Cancer Diseases
Design of an Intelligent System for Improving Classification of Cancer Diseases
 
Computer Security - CCNA Security - Lecture 2
Computer Security - CCNA Security - Lecture 2Computer Security - CCNA Security - Lecture 2
Computer Security - CCNA Security - Lecture 2
 
Computer Security - CCNA Security - Lecture 1
Computer Security - CCNA Security - Lecture 1Computer Security - CCNA Security - Lecture 1
Computer Security - CCNA Security - Lecture 1
 
Computer Security Lecture 4.1: DES Supplementary Material
Computer Security Lecture 4.1: DES Supplementary MaterialComputer Security Lecture 4.1: DES Supplementary Material
Computer Security Lecture 4.1: DES Supplementary Material
 
PMP Lecture 4: Project Integration Management
PMP Lecture 4: Project Integration ManagementPMP Lecture 4: Project Integration Management
PMP Lecture 4: Project Integration Management
 
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption StandardComputer Security Lecture 4: Block Ciphers and the Data Encryption Standard
Computer Security Lecture 4: Block Ciphers and the Data Encryption Standard
 
Computer Security Lecture 3: Classical Encryption Techniques 2
Computer Security Lecture 3: Classical Encryption Techniques 2Computer Security Lecture 3: Classical Encryption Techniques 2
Computer Security Lecture 3: Classical Encryption Techniques 2
 
Computer Security Lecture 2: Classical Encryption Techniques 1
Computer Security Lecture 2: Classical Encryption Techniques 1Computer Security Lecture 2: Classical Encryption Techniques 1
Computer Security Lecture 2: Classical Encryption Techniques 1
 
Computer Security Lecture 1: Overview
Computer Security Lecture 1: OverviewComputer Security Lecture 1: Overview
Computer Security Lecture 1: Overview
 
PMP Lecture 3: Project Management Processes
PMP Lecture 3: Project Management ProcessesPMP Lecture 3: Project Management Processes
PMP Lecture 3: Project Management Processes
 
PMP Lecture 2: Project Management Framework
PMP Lecture 2: Project Management FrameworkPMP Lecture 2: Project Management Framework
PMP Lecture 2: Project Management Framework
 

Último

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxAneriPatwari
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 

Último (20)

4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptx
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 

Algorithms Lecture 5: Sorting Algorithms II

  • 1. Analysis and Design of Algorithms Sorting Algorithms II
  • 2. Analysis and Design of Algorithms Counting Sort Radix Sort Merge Sort
  • 3. Analysis and Design of Algorithms Counting Sort
  • 4. Analysis and Design of Algorithms Counting sort is a sorting technique based on keys between a specific range. It works by counting the number of objects having distinct key values (kind of hashing). Then doing some arithmetic to calculate the position of each object in the output sequence.
  • 5. Analysis and Design of Algorithms Algorithm:  Step1: Create a count array to store the count of each unique object  Step2 : Modify count array by adding the previous number.  Step3 : Create output array by decrease count array
  • 6. Analysis and Design of Algorithms  Example 1 Assume the following Array in range of 0 to 5: 1 4 3 2 3 5 2
  • 7. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2
  • 8. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 0 0 0 0
  • 9. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 0 0 0 0
  • 10. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 0 0 0 0
  • 11. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 0 0 0
  • 12. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 0 0 0
  • 13. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 0 0 0
  • 14. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 0 0 0
  • 15. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 0 1 0
  • 16. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 0 1 0
  • 17. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 0 1 0
  • 18. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 1 1 0
  • 19. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 1 1 0
  • 20. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 0 1 1 0
  • 21. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 1 1 1 0
  • 22. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 1 1 1 0
  • 23. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 1 2 1 0
  • 24. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 1 2 1 0
  • 25. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 1 2 1 0
  • 26. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 1 2 1 1
  • 27. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 1 2 1 1
  • 28. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 1 2 1 1
  • 29. Analysis and Design of Algorithms  Create a count array to store the count of each unique object: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 2 2 1 1
  • 30. Analysis and Design of Algorithms  Modify count array by adding the previous number : 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 2 2 1 1
  • 31. Analysis and Design of Algorithms  Modify count array by adding the previous number : 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 2 2 1 1
  • 32. Analysis and Design of Algorithms  Modify count array by adding the previous number : 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 2 1 1
  • 33. Analysis and Design of Algorithms  Modify count array by adding the previous number : 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 5 1 1
  • 34. Analysis and Design of Algorithms  Modify count array by adding the previous number : 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 5 6 1
  • 35. Analysis and Design of Algorithms  Modify count array by adding the previous number : 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 5 6 7
  • 36. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 5 6 7
  • 37. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 5 6 7 1 2 3 4 5 6 7
  • 38. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 5 6 7 1 2 3 4 5 6 7
  • 39. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 5 6 7 1 2 3 4 5 6 7
  • 40. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 1 3 5 6 7 1 2 3 4 5 6 7 1
  • 41. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 5 6 7 1 2 3 4 5 6 7 1
  • 42. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 5 6 7 1 2 3 4 5 6 7 1
  • 43. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 5 5 7 1 2 3 4 5 6 7 1 4
  • 44. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 5 5 7 1 2 3 4 5 6 7 1 4
  • 45. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 5 5 7 1 2 3 4 5 6 7 1 4
  • 46. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 5 5 7 1 2 3 4 5 6 7 1 3 4
  • 47. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 4 5 7 1 2 3 4 5 6 7 1 3 4
  • 48. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 4 5 7 1 2 3 4 5 6 7 1 3 4
  • 49. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 4 5 7 1 2 3 4 5 6 7 1 3 4
  • 50. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 3 4 5 7 1 2 3 4 5 6 7 1 2 3 4
  • 51. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 4 5 7 1 2 3 4 5 6 7 1 2 3 4
  • 52. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 4 5 7 1 2 3 4 5 6 7 1 2 3 4
  • 53. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 4 5 7 1 2 3 4 5 6 7 1 2 3 4
  • 54. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 4 5 7 1 2 3 4 5 6 7 1 2 3 3 4
  • 55. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 3 5 7 1 2 3 4 5 6 7 1 2 3 3 4
  • 56. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 3 5 7 1 2 3 4 5 6 7 1 2 3 3 4
  • 57. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 3 5 7 1 2 3 4 5 6 7 1 2 3 3 4
  • 58. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 3 5 7 1 2 3 4 5 6 7 1 2 3 3 4 5
  • 59. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 3 5 6 1 2 3 4 5 6 7 1 2 3 3 4 5
  • 60. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 3 5 6 1 2 3 4 5 6 7 1 2 3 3 4 5
  • 61. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 3 5 6 1 2 3 4 5 6 7 1 2 3 3 4 5
  • 62. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 2 3 5 6 1 2 3 4 5 6 7 1 2 2 3 3 4 5
  • 63. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 1 3 5 6 1 2 3 4 5 6 7 1 2 2 3 3 4 5
  • 64. Analysis and Design of Algorithms  Output each object from the input sequence followed by decreasing its count by 1: 1 4 3 2 3 5 2 0 1 2 3 4 5 0 0 1 3 5 6 1 2 3 4 5 6 7 1 2 2 3 3 4 5
  • 65. Analysis and Design of Algorithms  Array is now sorted 1 2 2 3 3 4 5
  • 66. Analysis and Design of Algorithms 2 4 1 1 3  Example 2: 0 1 2 3 4 0 2 1 1 1 0 2 3 4 5 2 Count Range=[0-4] Add 1 2 3 4 5 Output 0 1 2 3 4 0 2 2 4 5Reduce 0 1 2 3 4 2 4 1 2 3 4 5 Output 0 2 2 4 4Reduce 0 1 2 3 4 1 2 4 1 2 3 4 5 Output 0 1 2 4 4Reduce 0 1 2 3 4 1 1 2 4 1 2 3 4 5 Output 0 0 2 4 4Reduce 0 1 2 3 4 1 1 2 3 4 1 2 3 4 5 Output 1 1 2 3 4 1 2 3 4 5 Sorted
  • 67. Analysis and Design of Algorithms  Python Code
  • 68. Analysis and Design of Algorithms
  • 69. Analysis and Design of Algorithms
  • 70. Analysis and Design of Algorithms  Time Complexity: O(n+k) where n is the number of elements in input array, and k is the range of input.  Example of worst case  Range between 1 to 10K 10 5 10k 5k 200
  • 71. Analysis and Design of Algorithms Radix Sort
  • 72. Analysis and Design of Algorithms  Radix sort is an algorithm that sorts numbers by processing digits of each number either starting from the least significant digit (LSD) or starting from the most significant digit (MSD).  The idea of Radix Sort is to do digit by digit sort starting from least significant digit to most significant digit. Radix sort uses counting sort as a subroutine to sort.
  • 73. Analysis and Design of Algorithms Algorithm:  Step1: Take the least significant digit of each element  Step2 : Sort the list of elements based on that digit  Step3 : Repeat the sort with each more significant digit
  • 74. Analysis and Design of Algorithms  Assume the following Array: 170 45 75 90 802 24 2 66
  • 75. Analysis and Design of Algorithms  The Sorted list will appear after three steps 170 45 75 90 802 24 2 66 170 90 802 2 24 45 75 66 802 2 24 45 66 170 75 90 2 24 45 66 75 90 170 802
  • 76. Analysis and Design of Algorithms  Step1: Sorting by least significant digit (1s place) 170 45 75 90 802 24 2 66 170 90 802 2 24 45 75 66
  • 77. Analysis and Design of Algorithms  Step2: Sorting by next digit (10s place) 170 90 802 2 24 45 75 66 802 2 24 45 66 170 75 90
  • 78. Analysis and Design of Algorithms  Step3: Sorting by most significant digit (100s place) 802 2 24 45 66 170 75 90 2 24 45 66 75 90 170 802
  • 79. Analysis and Design of Algorithms  Array is now sorted 2 24 45 66 75 90 170 802
  • 80. Analysis and Design of Algorithms  Example 2 1 2 3 5 8 3 1 5 4 5 6 7 6 8 9 6 2 5 4 5 6 1 2 3 5 8 3 1 5 4 6 2 5 4 5 6 5 6 7 6 8 9 1 2 3 6 2 5 1 5 4 4 5 6 5 6 7 5 8 3 6 8 9 1 2 3 1 5 4 4 5 6 5 6 7 5 8 3 6 2 5 6 8 9 1s 10s 100s
  • 81. Analysis and Design of Algorithms
  • 82. Analysis and Design of Algorithms  Python Code
  • 83. Analysis and Design of Algorithms  Python Code
  • 84. Analysis and Design of Algorithms Time Complexity: O(n+k/d) where n is the number of elements in input array, k is the range of input, and d is number of digits.
  • 85. Analysis and Design of Algorithms Merge Sort
  • 86. Analysis and Design of Algorithms  Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves.
  • 87. Analysis and Design of Algorithms Algorithm:  Step1: Divide the list recursively into two halves until it can no more be divided  Step2 : Merge (Conquer) the smaller lists into new list in sorted order
  • 88. Analysis and Design of Algorithms  Assume the following Array: 85 24 63 45 17 31 96 50
  • 89. Analysis and Design of Algorithms  Divide 85 24 63 45 17 31 96 50 85 24 63 45 17 31 96 50
  • 90. Analysis and Design of Algorithms  Divide 85 24 63 45 17 31 96 50 85 24 63 45 17 31 96 50 85 24 63 45 17 31 96 50
  • 91. Analysis and Design of Algorithms  Divide 85 24 63 45 17 31 96 50 85 24 63 45 17 31 96 50 85 24 63 45 17 31 96 50 85 24 63 45 17 31 96 50
  • 92. Analysis and Design of Algorithms  Sort & Merge 85 24 63 45 17 31 96 50
  • 93. Analysis and Design of Algorithms  Sort & Merge 85 24 63 45 17 31 96 50
  • 94. Analysis and Design of Algorithms  Sort & Merge 24 85 85 24 63 45 17 31 96 50
  • 95. Analysis and Design of Algorithms  Sort & Merge 24 85 85 24 63 45 17 31 96 50
  • 96. Analysis and Design of Algorithms  Sort & Merge 24 85 45 63 85 24 63 45 17 31 96 50
  • 97. Analysis and Design of Algorithms  Sort & Merge 24 85 45 63 85 24 63 45 17 31 96 50
  • 98. Analysis and Design of Algorithms  Sort & Merge 24 85 45 63 17 31 85 24 63 45 17 31 96 50
  • 99. Analysis and Design of Algorithms  Sort & Merge 24 85 45 63 17 31 85 24 63 45 17 31 96 50
  • 100. Analysis and Design of Algorithms  Sort & Merge 24 85 45 63 17 31 50 96 85 24 63 45 17 31 96 50
  • 101. Analysis and Design of Algorithms  Sort & Merge 24 85 45 63 17 31 50 96 85 24 63 45 17 31 96 50
  • 102. Analysis and Design of Algorithms  Sort & Merge 24 24 85 45 63 17 31 50 96 85 24 63 45 17 31 96 50
  • 103. Analysis and Design of Algorithms  Sort & Merge 24 45 24 85 45 63 17 31 50 96 85 24 63 45 17 31 96 50
  • 104. Analysis and Design of Algorithms  Sort & Merge 24 45 63 24 85 45 63 17 31 50 96 85 24 63 45 17 31 96 50
  • 105. Analysis and Design of Algorithms  Sort & Merge 24 45 63 85 24 85 45 63 17 31 50 96 85 24 63 45 17 31 96 50
  • 106. Analysis and Design of Algorithms  Sort & Merge 24 45 63 85 17 31 50 96 24 85 45 63 17 31 50 96 85 24 63 45 17 31 96 50
  • 107. Analysis and Design of Algorithms  Sort & Merge 17 24 31 45 50 63 85 96 24 45 63 85 17 31 50 96 24 85 45 63 17 31 50 96 85 24 63 45 17 31 96 50
  • 108. Analysis and Design of Algorithms  Array is now sorted 17 24 31 45 50 63 85 96
  • 109. Analysis and Design of Algorithms  Example 2
  • 110. Analysis and Design of Algorithms
  • 111. Analysis and Design of Algorithms
  • 112. Analysis and Design of Algorithms
  • 113. Analysis and Design of Algorithms Time Complexity: O(n * log(n) )
  • 114. Analysis and Design of Algorithms facebook.com/mloey mohamedloey@gmail.com twitter.com/mloey linkedin.com/in/mloey mloey@fci.bu.edu.eg mloey.github.io
  • 115. Analysis and Design of Algorithms www.YourCompany.com © 2020 Companyname PowerPoint Business Theme. All Rights Reserved. THANKS FOR YOUR TIME