To implement the following sorting algorithms:
Sorting is the process of arranging elements in a specific order, typically in ascending or descending order. Different sorting algorithms have different time complexities and efficiencies based on their approaches.
Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. This process repeats until the list is sorted.
Time Complexity: O(n²) in worst and average cases, O(n) in best case (when already sorted).
Insertion Sort builds the final sorted array one item at a time by taking elements from an unsorted list and inserting them into the correct position in a new sorted portion.
Time Complexity: O(n²) in worst and average cases, O(n) in best case.
Quick Sort is a divide-and-conquer algorithm that picks a pivot element, partitions the array around the pivot, and then recursively sorts the left and right partitions.
Time Complexity: O(n log n) on average, O(n²) in worst case (if the pivot is the smallest or largest element).
Selection Sort repeatedly finds the minimum element from the unsorted portion and moves it to the beginning.
Time Complexity: O(n²) in all cases.
Conclusion : Hence we have performed our practical successfully