Open In App

GATE | GATE CS Mock 2018 | Question 54

Consider the below Program and identify the problem:




void fun2(int arr[], int start_index, int end_index)
{
    if (start_index >= end_index)
        return;
    int min_index;
    int temp;
    min_index = minIndex(arr, start_index, end_index);
    swap(arr[start_index], arr[min_index]);
    fun2(arr, start_index + 1, end_index);
}

(A)



Selection Sort Recursive implementation

(B)



Bubble sort Recursive implementation

(C)

Finding Pair Recursive implementation

(D)

None of these


Answer: (A)
Explanation:

The function fun2() is a recursive implementation of Selection Sort.

Hence Option(A) is the correct answer.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :