Sorting n Searching Algorithm Part 2
Merge sort continuously cuts down a list into multiple sublists until each has only one item, then merges those sublists into a sorted list.
The list of size N is divided into a max of Logn parts, and the merging of all sublists into a single list takes O(N) time, the worst-case run time of this algorithm is O(nLogn) Best Case Time Complexity: O(nlog n)* Worst Case Time Complexity: O(nlog n) Average Time Complexity: O(nlog n)
Insertion sort is a simple sorting algorithm that works similar to the way you sort playing cards in your hands.
The first element in the array is assumed to be sorted. Take the second element and store it separately in key . Now, the first two elements are sorted. Take the third element and compare it with the elements on the left of it. Similarly, place every unsorted element at its correct position
Quicksort is a highly efficient sorting technique that divides a large data array into smaller ones.
Quick Sort is a divide and conquer algorithm. It creates two empty arrays to hold elements less than the pivot value and elements greater than the pivot value, and then recursively sort the sub arrays. There are two basic operations in the algorithm, swapping items in place and partitioning a section of the array
Shell sort is a generalized version of the insertion sort algorithm. It first sorts elements that are far apart from each other and successively reduces the interval between the elements to be sorted. The interval between the elements is reduced based on the sequence used.
Selection sort works by taking the smallest element in an unsorted array and bringing it to the front
Thankxx for Reading this file:)
Made with ❣ By Mona