Sorting Algorithms: [Link]
org/sorting-algorithms/
Selection Sort: [Link]
By repeatedly selecting the smallest or largest element from the unsorted portion of the list
and moving it to the sorted portion of the list.
The algorithm repeatedly selects the smallest or largest element from the unsorted portion
of the list and swaps it with the first element of the unsorted part. This process is repeated
for the remaining unsorted portion until the entire list is sorted
Bubble Sort: [Link]
By repeatedly swapping the adjacent elements if they are in the wrong order. This algorithm
is not suitable for large data sets as its average and worst-case time complexity is quite high.
In Bubble Sort algorithm,
Traverse from left and compare adjacent elements and the higher one is placed at right side.
In this way, the largest element is moved to the rightmost end at first.
This process is then continued to find the second largest and place it and so on until the data
is sorted.
Insertion Sort: [Link]
By iteratively inserting each element of an unsorted list into its correct position in a sorted
portion of the list. It is a stable sorting algorithm, meaning that elements with equal values
maintain their relative order in the sorted output.
A simple sorting algorithm that works by building a sorted array one element at a time. It is
considered an in-place sorting algorithm, meaning it doesn’t require any additional memory
space beyond the original array.