2. In this presentation, we will explore the
algorithm, a fundamental
sorting technique used in computer
science (along with bubble sort and
insertion sort) . We will delve into its
mechanics, advantages, and limitations,
providing a comprehensive
understanding of its functionality.
I)Introduction
3. Selection Sort
In a selection sort, the list to be sorted is divided into two
sublists—sorted and unsorted— which are separated by an
imaginary wall. We find the smallest element from the unsorted
sublist and swap it with the element at the beginning of the unsorted
sublist.
After each selection and swap, the imaginary wall between the two
sublists moves one element ahead, increasing the number of sorted
elements and decreasing the number of unsorted ones.
-Each time we move one element from the unsorted sublist to the
sorted sublist, we have completed a sort pass. A list of n elements
requires n − 1 passes to completely rearrange the data.
Figure 6.13 Algorithm of selection sort
4.
5. Understanding Selection Sort
The algorithm works by
repeatedly finding the minimum element
from the unsorted part and moving it to
the beginning. This process continues
until the entire array is sorted. While
simple in implementation, it is not
efficient for large datasets due to its
O(n^2) time complexity. (With n=number
of elements per array)
6. Find the minimum element in the
unsorted array.
Swap it with the first element.
Repeat the process for the remaining
unsorted portion. This step-by-step
approach is the essence of the
Selection-Sort Algorithm.
Algorithmic Steps
7. Pros and Cons
The algorithm's simplicity
makes it easy to implement and
understand. However, its O(n^2) time
complexity makes it inefficient for large
datasets. It is best suited for small arrays
where simplicity is prioritized over speed.
8.
9.
10.
11. *) Definition of Big-O Theorem:
-Big O notation is a mathematical notation that describes the limiting
behavior of a function when the argument tends towards a particular value
or infinity.
-Invented by German mathematicians Paul Bachmann,[1] Edmund
Landau,[2] and others, collectively called Bachmann–Landau
notation or asymptotic notation.
12.
13.
14.
15.
16.
17.
18.
19. Performance Analysis
When compared to more efficient sorting
algorithms like
the
and ,
algorithm falls short in
terms of performance. Its time complexity
makes it less suitable for large-scale
applications.
20. In conclusion, the algorithm,
while straightforward in its approach, is
not the most efficient sorting technique
for large datasets. Its simplicity and ease of
implementation make it suitable for small-
scale applications, but for larger datasets,
more efficient algorithms should be
considered.
Conclusion
21. Thanks!
Do you have any questions?
youremail@email.com
+91620 421 838
www.yourwebsite.com
@yourusername