SORTING ALGORITHM
SORTING ALGORITHM
Sorting Algorithms
Sorting algorithms are methods used to
arrange a list of items in ascending or
descending order. Common types include
Bubble Sort (compare and swap adjacent
items), Selection Sort (find the
smallest/largest item and place it correctly),
Insertion Sort (insert items into the correct
position), Merge Sort (divide, sort, and
merge), and Quick Sort (use a pivot to sort
Bubble Sort Algorithm
Bubble Sort Algorithm
Bubble Sort is a simple sorting
algorithm that works by
repeatedly comparing and
swapping adjacent elements if
they are in the wrong order
Insertion Sort
Algorithm
Insertion Sort
Algorithm
Insertion Sort is a simple
algorithm that works by building a
sorted list one element at a time.
Selection Sort
Algorithm
Selection Sort
Algorithm
Selection Sort is a simple comparison-
based sorting algorithm that works by
dividing the list into two parts:
1.Sorted part – On the left side of the
list.
2.Unsorted part – On the right side of
the list.
The algorithm repeatedly selects the
smallest (or largest) element from the
Merge Sort Algorithm
Merge Sort algorithm
Merge Sort is a divide and
conquer sorting algorithm
that splits a list into smaller
subarrays, sorts them, and
then merges them back
together in order.
THANK YOU