Which of the following sorting algorithms users recursion ?

Which of the following sorting algorithms users recursion ?
| Which of the following sorting algorithms users recursion ? 

A. Heap sort  

B. Bubble sort 

C. Merge sort 

D. Insertion sort 

Please scroll down to see the correct answer and solution guide.

Right Answer is: C

SOLUTION

Heapsort:

Heap data structure is an array object that can be viewed as a nearly complete binary tree. A heap can be a max or a min-heap. In a max heap, the maximum element will be the root of the tree, and in min heap minimum element will be the root of the tree. To make the right element as the root is heap sorting. It does not use recursion. It is based on the concept of a priority queue.

Bubble sort: 

It works by repeatedly moving the largest element to the highest index position of the array. It needs swapping of the elements. It compares the adjacent elements and swaps their positions if they are not in order. Order can be ascending or descending.

Insertion sort:

In this, array elements are compared to sequentially and arranged in order. It places the unsuitable element into its right position. It repeatedly inserts an element in the sorted subarray to its left. 

Merge sort: 

It is a divide and conquers based algorithm. It uses recursion to sort the elements of the array. In this, the array is divided into two parts until we get the sorted subarray, then combine and sort them again and the final result will be the sorted array of elements.  

Therefore merge sort algorithms users recursion.