Solved

Assuming a Method Int FindMax(int Array[ ],Int Last)that Returns the Subscript of the Subscript

Question 17

Multiple Choice

Assuming a method
Int findMax(int array[ ],int last) that returns the subscript of the largest value in the portion of an array whose elements are at 0 through last (inclusive) ,a recursive method for sorting in ascending order a portion of an array between 0 and last,inclusive,can be written as follows:
Void rSort(int array[ ],int last) {
If (last >= 1) {
// Missing code
}
}
If a method
Void swap(int array[ ],int pos1,int pos2) can be used to swap the contents of two array entries,then the logic for the missing code is


A) findMax(array,array.length-1) ;rSort(array,array.length-1) ;
B) int p = findMax(array,array.length-1.;rSort(array,p.;
C) int p = findMax(array,last.;swap(array,p,last.;rSort(array,last-1.;
D) rSort(array,last-1.;int p = findMax(array,last.;swap(array,p,last.;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents