# Bubble Sort

It is on of the easiest sorting technique and everybody starts with this sort because it will show us how sorting works which are simple and it works repeatedly swapping the elements if they are not in the correct order. It starts from first element and goes on until to the last element then some of the elements will be sorted and then revolution takes place until the array is sorted but it may take time and it can be optimized by stopping the algorithm if no swapping is done.

• The average time increases almost exponentially as the number of table elements increase.
• Larger data sets require more complex code and more memory.
• It is a simple sorting technique that sorts the items in a memory.

# Selection sort

It is quite simple algorithm when we compare to bubble sort this one is better.

• The main point is that this algorithm will do well on a small list than a larger list.
• similar to bubble sort it will also take n squared number of steps fo sorting n elements.
• It’s performance is easily influenced by the initial ordering of the items before the sorting process.

# Insertion sort

Insertion sort is a basic arranging calculation that forms the last arranged sorted array or list each thing in turn. It is significantly less effective on enormous records than further developed calculations, for example, merge sort, heapsort, or quicksort. Insertion sort repeats, devouring one information component every reiteration, and grows an arranged yield list. At every emphasis, inclusion sort eliminates one component from the information, finds the area it has a place inside the arranged rundown, and supplements it there. It rehashes until no info components remain.

• This sorting technique uses minimal amount of space.
• With n-squared steps required for every n element to be sorted.
• This technique is particularly used when there are low number of elements in a list.

# Merge Sort

From now on the difficulty level increases. It is a perfect example for divide and conquer algorithm because in this sorting technique we divide the whole array into a single part and then checks each and part whether which is bigger or smaller then it compares them and swap their places after sorting two elements then they are compared with the next two elements and then after sorting them they conquer and al last all of the elements in the array or list will be sorted.

• It can be used for any size of array or list.
• If heap sort is used for the in-memory part of the merge, its operation can be overlapped with I/O.
• merge sort required more space then other sorting technique.

# Quick Sort

It is also going to use divide and conquer method like merge sort. It picks an element as pivot and partitions the given array around the picked pivot. There are many different versions of quick Sort that pick pivot in different ways and it is bit more complicated. This algorithm have mainly three steps. First we need to select a pivot element in the array we can pick any element. Second move all the elements to the left of the pivot when the element is smaller than that and move the element to right side of pivot if the element is larger than pivot. Third step, recursively call the above two steps for the subarrays of the element with smaller and bigger elements then the pivot.

• This algorithm widely used when we have huge amount of elements.
• Because it sorts in exact place where it was divided, no additional storage is required as well.
• All elements in the first sub list are arranged to be smaller than the pivot.

--

--