Choose The Correct Function For Recursive Bubble Sort #1017
Choose the correct function for recursive bubble sort?
This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Sorting - Recursive Bubble Sort - Quiz No.2.
Choose the correct function for recursive bubble sort?
void rec_bubbleSort(int arr[], int n) { if (n == 1) return; for (int i=0; i<n-1; i++) if (arr[i] > arr[i+1]) { swap(arr[i], arr[i+1]); } rec_bubbleSort(arr, n-1); }
void rec_bubbleSort(int arr[], int n) { if (n == 2) return; for (int i=0; i<n-1; i++) if (arr[i] > arr[i+1]) { swap(arr[i], arr[i+1]); } rec_bubbleSort(arr, n-1); }
void rec_bubbleSort(int arr[], int n) { if (n == 1) return; for (int i=0; i<n-1; i++) if (arr[i] < arr[i+1]) { swap(arr[i], arr[i+1]); } rec_bubbleSort(arr, n-1); }
void rec_bubbleSort(int arr[], int n) { if (n == 2) return; for (int i=0; i<n-1; i++) if (arr[i] < arr[i+1]) { swap(arr[i], arr[i+1]); } rec_bubbleSort(arr, n-1); }
Similar question(s) are as followings:
Online Quizzes of gs122 Data Communication and Computer Network
Sorting - Insertion Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.3
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - LSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes