0% found this document useful (0 votes)
13 views177 pages

Design & Analysis of Algorithms - Topic 4 - Introduction to the Design of Sorting Algorithms

The document introduces sorting algorithms, emphasizing their importance in organizing data for improved readability and efficient searching. It discusses various classification parameters such as time complexity, space complexity, stability, and whether the sorting is internal or external, as well as recursive versus non-recursive methods. The document also outlines the basic comparison block used in constructing sorting algorithms and provides an example of a simple sorting algorithm.

Uploaded by

babuurao989
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views177 pages

Design & Analysis of Algorithms - Topic 4 - Introduction to the Design of Sorting Algorithms

The document introduces sorting algorithms, emphasizing their importance in organizing data for improved readability and efficient searching. It discusses various classification parameters such as time complexity, space complexity, stability, and whether the sorting is internal or external, as well as recursive versus non-recursive methods. The document also outlines the basic comparison block used in constructing sorting algorithms and provides an example of a simple sorting algorithm.

Uploaded by

babuurao989
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 177

DESIGN & ANALYSIS OF

ALGORITHMS

Topic 4
Introduction to the Design of
Sorting Algorithms
INSTRUCTOR: Sulaman Ahmad Naz
Sorting
■ In this lesson and in this series of lessons we are
going to talk about sorting algorithms.

■ Sorting as a concept is deeply embedded in a


lot of things that we do.

■ It's quite often that we like to arrange things or


data in certain order.

2
Sorting
■ Sometimes to improve the readability of that data,
so that others might be able to search or extract
some information quickly out of that data.

■ For example:
We keep currency notes sorted.

3
Sorting
■ Now, have a look at this, when we go to an online
marketplace such as OLX.
■ The site gives us options of sorting the items.

4
Sorting
■ So, sorting is a really helpful feature here and there
are so many places where we like to keep our data
sorted.
■ Be it the language dictionary where we want to keep
the words sorted so that searching a word in the
dictionary is easy.

5
Sorting
■ If we want to define sorting formally, then sorting is
arranging the elements in a list or collection in
increasing or decreasing order of some property.

■ The list should be homogeneous, that is all the


elements in the list should be of same type.

■ To study sorting algorithms, most of the times we use


a list of integers, and typically we sort the list of
integers in increasing order of value.
6
Sorting
■ For example, if we have the following list:

12 21 6 8 5

■ Then sorting in increasing order of values will mean


rearranging the above values as:

5 6 8 12 21

7
Sorting
■ For example, if we have the following list:

12 21 6 8 5

■ Similarly, sorting in decreasing order of values will


result as following permutation of the above list:

21 12 8 6 5

8
Sorting
■ For example, if we have the following list:

12 21 6 8 5

■ But we can sort on any property of data, it is not just


the magnitude of values, like increasing number of
factors.

9
Sorting
■ For example, if we have the following list:
12 21 6 8
5
1,2, 1,3, 1,2, 1,2,
1,5
3,4, 7,21 3,6 4,8
6,12

■ But we can sort on any property of data, it is not just


the magnitude of values, like increasing number of
factors.
5 21 6 8 12

10
Sorting
■ A sorted list is the permutation of the original list,
When we sort a list, we just rearrange the elements.

■ Now this was a list of integers. We may have a list of


any data type. We may want to sort a list of strings or
words in lexicographical order, the order in which they
will occur in dictionary.

11
Sorting

“fork” “knife” “screen” “mouse” “key”

■ A list of strings like above in alphabetical order will


be arranged as below:

“fork” “key” “knife” “mouse” “screen”

12
Sorting

“fork” “knife” “screen” “mouse” “key”

■ A list of strings like above in lexicographical order


will be arranged as below:

“key” “fork” “knife” “mouse” “screen”

13
Sorting
■ And we may have a list of complex data type as well.

■ A car object in the OLX website, that we had seen


earlier, was a complex type.

■ Cars will have many properties, like the following, and


the list can be sorted on any of these properties.
– Price
– Relevancy
– Date of inclusion in the database
– Etc. 14
Sorting
■ Sorted data is good, not just for presentation or manual
retrieval of information, but even when we are using
computational power of machines, sorted data is really
helpful.
■ If a list is stored in computer's memory as unsorted, then
to search something in this list, we will have to run Linear
Search. (We cannot do binary search on unsorted data)
■ In linear search, we start with the first element of the list
and keep scanning the whole list, until we get the element
that we are looking for, so, in the worst case, like, when an
element will not be there in the list, we will compare it with
all the elements in the list, we will scan it with whole list.
15
Sorting
■ So, if there are n elements in the list, we will make n
comparisons in the worst case.
■ Just, think about the kind and amount of data, modern
day computers deal with.
■ What if this n is very very large! If we take n=2128
items and imagine that 1 comparison takes 1
millisecond.
■ Then how much time is required to search a value in
the worst case?
Time = 2128 milliseconds
16
Sorting
Time = 2128 milliseconds
= 340282366920938000000000000000000000000 milli
Time = 10790283070806000000000000000 years
■ But, if data was sorted, by using binary search, it
would take only 128 milliseconds.
Time = log22128 = 128 milliseconds
Time = 0.128 second
17
Sorting
■ Now, you can imagine how important sorting as a
problem is.

■ Sorting as a problem is well studied and a great deal of


research has gone into devising efficient algorithms for
sorting.

■ In this series of lessons we are going to study, analyze,


and compare these sorting algorithms.
18
Sorting
■ Some of the sorting algorithms that we will be talking
about, that we will be analyzing about are:

19
Sorting
■ We have so many algorithms for sorting that have been
designed over a period of time.

■ We often classify sorting algorithms based on some parameters.

■ The first parameter that we want to classify upon is time


complexity which is the measure of rate of growth of time taken
by an algorithm with respect to input size.

■ Some algorithms will be relatively faster than others.

20
Sorting w.r.t Time Complexi

Sorting Algorithms

Polynomial Time
n.Logrithmic Time Linear Time

Bubble Sort Quick Sort Counting Sort


Selection Sort Merge Sort Radix Sort
Insertion Sort Heap Sort Bucket Sort

21
Sorting
■ The second parameter that we use for classification is space
complexity or memory usage.

■ Some sorting algorithms are in-place, they use constant i.e.


O(1) or logarithmic i.e. O(log n) amount of extra memory to
rearrange the elements in the list.

■ While some sorting algorithms use extra memory to


temporarily store data and the memory usage grows with
input size. These are called out-place sorting algorithms.
Here, the S(n) > (log n)
22
Sorting w.r.t Space Complexi

Sorting Algorithms

In-Place Out-Place

Bubble Sort Merge Sort


Selection Sort Counting Sort
Insertion Sort
Quick Sort 23
Sorting
■ The third parameter that we talk about is stability.
■ A stable sorting algorithm guarantees that in the case
of duplicate values, the relative order of elements is
preserved.
Unsorted List: 12 21 6 8 6

After stable sorting: 6 6 8 12 21

After unstable sorting: 6 6 8 12 21


24
Sorting w.r.t Stability

Sorting Algorithms

Stable Unstable

Bubble Sort Quick Sort


Merge Sort Heap Sort
Insertion Sort Selection Sort

25
Sorting
■ The next parameter of classification is whether a sort is
internal sort or external sort.

■ When all the records that need to be sorted in the main


memory or RAM, then such sort is internal sort.

■ And if the records are on auxiliary storage like disk and


tapes, quite often because it's not possible to get all of
them in the main memory in one go, then we call such a
sort external sort.
26
Sorting w.r.t Location of Valu

Sorting Algorithms

Internal External

Bubble Sort Merge Sort (Hybrid version


Quick Sort Distribution Sort
Insertion Sort

27
Sorting
■ The next parameter upon which we may classify sorting
algorithms is whether algorithm is recursive or non
recursive in nature.

28
Sorting w.r.t Design

Sorting Algorithms

Iterative Recursive

Bubble Sort Merge Sort


Selection Sort Quick Sort
Insertion Sort

29
Sorting
■ There is one more parameter upon which we may classify
sorting algorithms, and it is whether algorithm compares
the values or does sorting in some other way.

■ A comparison sort algorithm sorts items by comparing


values between each other. It can be applied to any input.

■ A non-comparison sort algorithm uses the internal


character of the values to be sorted. It can only be applied
to some particular cases, and requires particular values.
30
Sorting w.r.t Compariso

Sorting Algorithms

Comparison Sorting Non-Comparison Sorting

Bubble Sort Counting Sort


Selection Sort Radix Sort
Insertion Sort Bucket Sort

31
The Basic Comparison Block

3
■ Before starting to learn
sorting algorithms, lets start
with a very basic comparison 4 4
block.

■ It takes two numbers as an 3


input and tells which one is
smaller and vice versa.

32
The Basic Comparison Block

num1
If num1 <= num2
Pop_Down num1
Pop_Right num2 num2 larger
Else
Pop_Down num2
Pop_Right num1 smaller

Now, we will combine these blocks in a triangular way and try to sort a list.
33
5
Constructing Our
4 5 1st Sorting Algorithm
4
After each step, we
3 4 5 get/select the
minimum element of
3 4 the (remaining) list.

1 3 4 5

1 3 4

2 2 3 4

1 2 3 4 5 34
Observations

 The minimum value is “SELECTED” after each iteration.

 The maximum value is “SELECTED” after each iteration.



 Input size is reduced after each iteration. (Decrease & Conquer)

 The mechanism of the algorithm reflects “Iterative Improvement” design
paradigm.
 It belongs to “Divide & Conquer” class of algorithms.

 The comparison block does not apply when only 1 one number is left.
 The problem is recursive-only in nature.

 The problem is iterative in nature.
35
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

36
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

37
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

38
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

39
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

40
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

41
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

42
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

43
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

44
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

45
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

46
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

47
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

48
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
12 21 6 8 5

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

49
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

50
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

51
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

52
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

53
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

54
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

55
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

56
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

57
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

58
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

59
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 21 6 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

60
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

61
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

62
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

63
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

64
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

65
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

66
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

67
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

68
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 21 8 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

69
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 21 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

70
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 21 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

71
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 21 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

72
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 21 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

73
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 21 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

74
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 21 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

75
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 21 12

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

76
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 12 21

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

77
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 12 21

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

78
1st Sorting Algorithm
L U
Algorithm ColumnWiseSorting(List[L…U])
5 6 8 12 21

For i = L to U-1 i j
Min
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]

79
Recall: The Basic Comparison
Block
num1
If num1 <= num2
Pop_Down num1
Pop_Right num2 num2 larger
Else
Pop_Down num2
Pop_Right num1 smaller

Again, we will combine these blocks in a triangular way and try to sort a list.
80
5
5
Constructing Our
4 2nd Sorting Algorithm
4 5
After each step, we
3 4 insert the next
element in its correct
3 4 5 position in the sorted
sub-list.
1 3 4

1 3 4 5

2 2 3 4

1 2 3 4 5 81
Observations
 The minimum value is “SELECTED” after each iteration.
 The maximum value is “SELECTED” after each iteration.
 Input size is reduced after each iteration. (Decrease & Conquer)
 The mechanism of the algorithm reflects “Iterative Improvement” design paradigm.
 It belongs to “Divide & Conquer” class of algorithms.
 The comparison block does not apply when only 1 one number is left.
 The problem is recursive-only in nature.

 The problem is iterative in nature.
 After each iteration, the considered element is “INSERTED” in its final sorted location.

 After each iteration, the considered element is “INSERTED” in its current sorted location.
82
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break
List[ j+1 ] = List[ j ]
List[ j+1 ] = value
83
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break
List[ j+1 ] = List[ j ]
List[ j+1 ] = value
84
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 21

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
85
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 21

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
86
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 21

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
87
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 21

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
88
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 21

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
89
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 21

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
90
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
91
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
92
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 6 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
93
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
94
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
95
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 21 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
96
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 12 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
97
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])
12 12 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
98
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
99
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 6

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
100
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
101
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
102
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 21 8 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
103
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 21 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
104
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 21 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
105
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 21 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
106
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
107
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
108
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
109
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 12 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
110
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
111
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 8

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
112
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
113
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
114
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 21 5

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
115
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 21 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
116
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 21 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
117
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 21 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
118
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
119
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
120
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 12 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
121
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 8 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
122
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 8 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
123
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 8 8 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
124
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 6 8 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
125
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])6 6 8 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
126
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])5 6 8 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
127
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])5 6 8 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
128
2nd Sorting Algorithm
L U
Algorithm RowWiseSorting(List[L…U])5 6 8 12 21

For i = L+1 to U j i
value=List[i]
For j = i-1 to L
If List[ j ] < value value
break 5

List[ j+1 ] = List[ j ]


List[ j+1 ] = value
129
Comparing Both Algorithms
After each step, we get / After each step, we
SELECT the minimum INSERT the next element
element of the (remaining) in its correct position in
list. the sorted sub-list.
RowWiseSorting(List[L…U])
ColumnWiseSorting(List[L…U])
For i = L to U-1 For i = L+1 to U
Min=i value=List[i]
For j = i+1 to U For j = i-1 to L
If List[ j ] < If List[ j ] < value
List[Min] break
Min=j List[ j+1 ] = List[ j ]
Swap List[i]↔List[Min] List[ j+1 ] = value
130
Comparing Both Algorithms
SELECTION SORT INSERTION SORT

ColumnWiseSorting(List[L…U]) RowWiseSorting(List[L…U])
For i = L to U-1 For i = L+1 to U
Min=i value=List[i]
For j = i+1 to U For j = i-1 to L
If List[ j ] < If List[ j ] < value
List[Min] break
Min=j List[ j+1 ] = List[ j ]
Swap List[i]↔List[Min] List[ j+1 ] = value
131
Another Basic Sorting Block

■ Before starting to learn out 4 3


third sorting algorithm, lets
have a look at another very
basic sorting block.

■ It also takes two numbers in a 3 4


circle and tells which one is
smaller and vice versa.

132
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 21 6 8 5

133
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 21 6 8 5

i 134
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 21 6 8 5

j
i 135
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 21 6 8 5

j
i 136
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 21 6 8 5

j
i 137
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 21 6 8 5

j
i 138
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 21 8 5

j
i 139
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 21 8 5

j
i 140
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 21 8 5

j
i 141
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 8 21 5

j
i 142
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 8 21 5

j
i 143
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 8 21 5

j
i 144
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 8 5 21

j
i 145
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 8 5 21

j
i 146
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 8 5 21

j
i 147
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 8 5 21

j
i 148
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
12 6 8 5 21

j
i 149
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 12 8 5 21

j
i 150
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 12 8 5 21

j
i 151
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 12 8 5 21

j
i 152
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 12 5 21

j
i 153
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 12 5 21

j
i 154
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 12 5 21

j
i 155
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 5 12 21

j
i 156
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 5 12 21

j
i 157
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 5 12 21

j
i 158
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 5 12 21

j
i 159
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 5 12 21

j
i 160
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 5 12 21

j
i 161
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 8 5 12 21

j
i 162
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 5 8 12 21

j
i 163
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 5 8 12 21

j
i 164
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 5 8 12 21

j
i 165
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 5 8 12 21

j
i 166
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
6 5 8 12 21

j
i 167
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
5 6 8 12 21

j
i 168
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
5 6 8 12 21

j
i 169
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
5 6 8 12 21

j
i 170
3rd Sorting Algorithm
Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
L U
5 6 8 12 21

j
i 171
Observations
 The minimum value is placed after each iteration.
 The maximum value is placed after each iteration.
 Input size is reduced after each iteration. (Decrease & Conquer)

 The mechanism of the algorithm reflects “Iterative Improvement” design paradigm.
 It belongs to “Divide & Conquer” class of algorithms.
 The comparison block does not apply when only 1 one number is left.
 The problem is recursive-only in nature.

 The problem is iterative in nature.
 After each iteration, the considered element is placed in its final sorted location.
  After each iteration, the considered element is placed in its current sorted location.
172
Class Activity (1.5 hrs)

Calculate Best/Worst/Average Case


Time Complexity of:
■ Selection Sort
■ Bubble Sort
■ Insertion Sort
Consider the following:
1. Comparisons
2. Swaps/Shifts

173
SELECTION SORT
ColumnWiseSorting(List[L…U])
For i = L to U-1
Min=i
For j = i+1 to U
If List[ j ] < List[Min]
Min=j
Swap List[i]↔List[Min]
174
BUBBLE SORT

Algorithm BubbleSort(List[L…U])
For i = U-1 to L
For j = L to i
If List[ j ] > List[ j+1 ]
Swap List[ j ] =
List[ j+1 ]
175
INSERTION SORT
RowWiseSorting(List[L…U])
For i = L+1 to U
value=List[i]
For j = i-1 to L
If List[ j ] < value
break
List[ j+1 ] = List[ j ] //shift
List[ j+1 ] = value
176
End of Lecture

THANK YOU
177

You might also like