Which Of The Following Function Chooses A Random Index As Pivot #676
Which of the following function chooses a random index as 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 Random Sampling - Quiz No.2.
Which of the following function chooses a random index as pivot.
void partition_random(int arr[], int low, int high) { srand(time(NULL)); int random = low + rand() % (high - low); swap(arr[random], arr[high]); }
void partition_random(int arr[], int low, int high) { srand(time(NULL)); int random = high + rand() % (high - low); swap(arr[random], arr[high]); }
void partition_random(int arr[], int low, int high) { srand(1); int random = low + rand() % (high - low); swap(arr[random], arr[high]); }
void partition_random(int arr[], int low, int high) { srand(time(NULL)); int random = low + rand() % (high - low-1); swap(arr[low], arr[high]); }
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