Computer Science, asked by zacking, 7 months ago

What are the two types of sorting ? Explain with an example​

Answers

Answered by jprctc58
24

Answer:

Quick Sort - A sorting algorithm which divides the elements into two subsets and again sorts recursively. Merge sort - A sorting algorithm which divides the elements to subgroups and then merges back to make a sorted. Radix Sort - A sorting algorithm used for numbers.

I hope it is help you

Please follow me and my answer

Please mark as Brainliest answer

Answered by dram63
12

Answer:

In C programming language, there are multiple sorting algorithms available, which can be incorporated inside the code. The various types of sorting methods possible in the C language are Bubble sort, Selection sort, Quick sort, Merge sort, Heap sort and Insertion sort.

Explanation:

1. Bubble Sort

Bubble sort may be defined as the sorting algorithm that follows the approach of replacing the value in the first index with the smallest value in the array and keep it repeating until the list is sorted. It is a very simple way of performing sorting. In this way to sort the array, the value has to be assigned to the array in the beginning before starting the sorting.

2. Selection Sort  

The selection sort may be defined as another algorithm for sorting the list in which the array is bifurcated into two arrays where the first array is supposed to be empty while the second array consists of the unsorted list of values. The program searches for the smallest values in the second array and when the value is found, it has been moved to the beginning of the first array that was empty. The approach is repeated again and the next smallest values will be shifted to the second index of the first array. The processes will keep on repeating until the second array became empty.

3. Quick Sort

Quicksort can be defined as the other algorithm for sorting the list in which the approach is to divide the array in terms of greater than and less than values until the entire values if divided into individuals forms. In this algorithm, the value of the last index of the array has been selected as a pivot and all the values smaller than pivot has been shifted to the array that is expected to occur in the left of the value and the elements having a higher value than the pivot are shifted to the right array. Again one pivot is selected from the newly formed array that had the values less than the last pivot value. Similarly, the values smaller than the new pivot will be shifted to the array that will be left and the values more than the new pivot will be shifted in the right array.

4. Merge Sort

Merge sort may be defined as another sorting algorithm that performs the sorting by segregating the array till last when it turns into an individual value and then aggregating them in a manner so that it could turn into a sorted array.

The process consumes a bit much time as compared to the other rival algorithms but it is considered pretty efficient as compared to others. When it comes to sorting a large list, this algorithm works very fine and hence preferred in developing the application that has to process the large list.

5. Heapsort

The heap sort can be defined as the sorting algorithm that works by searching the maximum element in the list and place it to the last. The algorithm performs the action recursively until the array gets sorted into the ascending way.

It is very time taking the process to choose the maximum value and move it to the last and hence it is considered as a less efficient sorting approach when it comes to sorting the large list. However, it works fine with the list that has a limited number of values.

6. Insertion Sort

Insertion sort may be defined as the sorting algorithm that works by moving the minimum value at the beginning of the list one at a time. This is a very less efficient sorting algorithm and not found suitable to deal with the large list.

This approach of sorting the algorithm works very slowly and usually not preferred in any of the applications. It can work good with the list that has pretty few numbers of elements. For the applications, that have the requirement to process a few numbers of values can leverage this algorithm.

MARK AS BRAINLIEST...

Similar questions