Open In App
Related Articles

GATE | GATE CS Mock 2018 | Question 54

Improve Article
Improve
Save Article
Save
Like Article
Like

Consider the below Program and identify the problem:

C++




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

Level Up Your GATE Prep!
Embark on a transformative journey towards GATE success by choosing Data Science & AI as your second paper choice with our specialized course. If you find yourself lost in the vast landscape of the GATE syllabus, our program is the compass you need.

Last Updated : 03 Jan, 2018
Like Article
Save Article
Previous
Next
Similar Reads