Which Of The Following Function Chooses A Random Index As The #687
Which of the following function chooses a random index as the pivot?
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 - Quicksort using Median-of-Three Partitioning - Quiz No.1.
Which of the following function chooses a random index as the pivot?
int Median(arr, left, right) { int mid; mid = (left + right)/2 if (arr[right] < arr[left]); Swap(arr, left, right); //to swap arr[left],arr[right] if (arr[mid] < arr[left]); Swap(arr, mid, left);//to swap arr[left],arr[mid] if (arr[right] < arr[mid]); Swap(arr, right, mid);// to swap arr[right],arr[mid] return mid; }
int Median(arr, left, right) { int mid; mid = (left + right)/2 if (arr[right] > arr[left]); Swap(arr, left, right); //to swap arr[left],arr[right] if (arr[mid] < arr[left]); Swap(arr, mid, left);//to swap arr[left],arr[mid] if (arr[right] < arr[mid]); Swap(arr, right, mid);// to swap arr[right],arr[mid] return mid; }
int Median(arr, left, right) { int mid; mid = (left + right)/2 if (arr[left] < arr[right]); Swap(arr, left, right); //to swap arr[left],arr[right] if (arr[left] < arr[mid]); Swap(arr, mid, left);//to swap arr[left],arr[mid] if (arr[right] < arr[mid]); Swap(arr, right, mid);// to swap arr[right],arr[mid] return mid; }
int Median(arr, left, right) { int mid; mid = (left + right)/2 if (arr[right] < arr[left]); Swap(arr, left, right); //to swap arr[left],arr[right] if (arr[left] < arr[mid]); Swap(arr, mid, left);//to swap arr[left],arr[mid] if (arr[mid] < arr[right]); Swap(arr, right, mid);// to swap arr[right],arr[mid] return mid; }
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