Welcome to my
presentation
on
“SORTING”
NAME : MD. EFTEKHARUL ISLAM
ID: 151311041
SEC : B
DEPT : CSE
SEMESTER : 4TH BATCH : 8TH
SORTING : Sorting refers to arranging data in a
particular format. Sorting algorithm specifies the
way to arrange data in a particular order.
• Importance of sorting lies in the fact that data
searching can be optimized to a very high level if
data is stored in a sorted manner. Sorting is also
used to represent data in more readable formats.
Some of the examples of sorting in real life scenarios
are following.
• Telephone Directory − Telephone directory keeps
telephone no. of people sorted on their names. So
that names can be searched.
• Dictionary − Dictionary keeps words in alphabetical
order so that searching of any work becomes easy.
A few different algorithms that are popular
in data structure :
• Bubble Sort : Exchange two adjacent elements if they
are out of order. Repeat until array is sorted.
• Insertion sort : Scan successive elements for an out-of-
order item, then insert the item in the proper place.
• Selection sort : Find the smallest element in the array,
and put it in the proper place. Swap it with the value in
the first position. Repeat until array is sorted.
• Quick sort : Partition the array into two segments. In the
first segment, all elements are less than or equal to the
pivot value. In the second segment, all elements are
greater than or equal to the pivot value. Finally, sort the
two segments recursively.
• Merge sort : Divide the list of elements in two parts, sort
the two parts individually and then merge it.
Bubble Sort : Bubble sort is a simple sorting algorithm.
This sorting algorithm is comparison based algorithm in
which each pair of adjacent elements is compared and
elements are swapped if they are not in order.
• Bubble sort is a simple sorting algorithm. The algorithm starts
at the beginning of the data set. It compares the first two
elements, and if the first is greater than the second, it swaps
them. It continues doing this for each pair of adjacent elements
to the end of the data set. It then starts again with the first two
elements, repeating until no swaps have occurred on the last
pass. This algorithm's average and worst-case performance is
O(n2), so it is rarely used to sort large, unordered data sets.
Bubble sort can be used to sort a small number of items (where
its asymptotic inefficiency is not a high penalty). Bubble sort
can also be used efficiently on a list of any length that is nearly
sorted (that is, the elements are not significantly out of place).
How bubble sort works?
We take an unsorted array for our example. Bubble sort take Ο(n2) time
so we're keeping short and precise. Bubble sort starts with very first two
elements, comparing them to check which one is greater.
How bubble sort works?
And when there's no swap required, bubble
sorts learns that array is completely sorted.
Thank you all.

Sorting

  • 1.
    Welcome to my presentation on “SORTING” NAME: MD. EFTEKHARUL ISLAM ID: 151311041 SEC : B DEPT : CSE SEMESTER : 4TH BATCH : 8TH
  • 2.
    SORTING : Sortingrefers to arranging data in a particular format. Sorting algorithm specifies the way to arrange data in a particular order. • Importance of sorting lies in the fact that data searching can be optimized to a very high level if data is stored in a sorted manner. Sorting is also used to represent data in more readable formats. Some of the examples of sorting in real life scenarios are following. • Telephone Directory − Telephone directory keeps telephone no. of people sorted on their names. So that names can be searched. • Dictionary − Dictionary keeps words in alphabetical order so that searching of any work becomes easy.
  • 3.
    A few differentalgorithms that are popular in data structure : • Bubble Sort : Exchange two adjacent elements if they are out of order. Repeat until array is sorted. • Insertion sort : Scan successive elements for an out-of- order item, then insert the item in the proper place. • Selection sort : Find the smallest element in the array, and put it in the proper place. Swap it with the value in the first position. Repeat until array is sorted. • Quick sort : Partition the array into two segments. In the first segment, all elements are less than or equal to the pivot value. In the second segment, all elements are greater than or equal to the pivot value. Finally, sort the two segments recursively. • Merge sort : Divide the list of elements in two parts, sort the two parts individually and then merge it.
  • 4.
    Bubble Sort :Bubble sort is a simple sorting algorithm. This sorting algorithm is comparison based algorithm in which each pair of adjacent elements is compared and elements are swapped if they are not in order. • Bubble sort is a simple sorting algorithm. The algorithm starts at the beginning of the data set. It compares the first two elements, and if the first is greater than the second, it swaps them. It continues doing this for each pair of adjacent elements to the end of the data set. It then starts again with the first two elements, repeating until no swaps have occurred on the last pass. This algorithm's average and worst-case performance is O(n2), so it is rarely used to sort large, unordered data sets. Bubble sort can be used to sort a small number of items (where its asymptotic inefficiency is not a high penalty). Bubble sort can also be used efficiently on a list of any length that is nearly sorted (that is, the elements are not significantly out of place).
  • 5.
    How bubble sortworks? We take an unsorted array for our example. Bubble sort take Ο(n2) time so we're keeping short and precise. Bubble sort starts with very first two elements, comparing them to check which one is greater.
  • 6.
    How bubble sortworks? And when there's no swap required, bubble sorts learns that array is completely sorted.
  • 7.