Algorithm: Insertion Sort

Algorithms

Insertion Sort repeatedly takes the next element and inserts it into its correct position within the sorted part of the array.

Basically, it finds the correct position of an element and inserts it in that correct position. In that process, it shifts the rest of the elements to make space for that key element.

This is not a very efficient sorting algorithm, but it is easy to understand, as there are lots of swapping/shifting operations involved.

Algorithm: Selection Sort

Algorithms

Selection sort is a comparison-based sorting algorithm. It works by repeatedly finding the smallest element from the unsorted part of the array, and placing it at the beginning.

It is easy to understand and implement the algorithm, but it has a time complexity of O(n^2). So, very inefficient for large datasets.

Algorithm: Big O Notation

Algorithm

There are the big O notations that we commonly encounter- Big O Notation Name Description O(1) Constant O(n) Linear O(n^2) Quadratic O(n^3) Cubic O(log(n)) Logarithmic (Log Linear) O(n log(n)) Linearithmic O(n!) Factorial O(2^n) Exponintial

Algorithm: Bubble Sort

Algorithms

Bubble sort is one of the most common sorting algorithms. It is a really simple sorting algorithm, but it is a very inefficient algorithm to handle large set of data.

In this algorithm, we go through the data set, and bubble up the largest number(item) to the end of the list. We do it one by one, and by traversing through the set of data, and swapping the largest number to the end.