to implement the function intmaxArray(int A[], int first, int last) which return
ID: 3612661 • Letter: T
Question
to implement the function intmaxArray(int A[], int first, int last) which returns the largest ofthe numbers A[first]...A[last]. If first=last we have the base case-- return A[first]. If first >last, let mid be (first+last)2.The function calls itself with arguments A,first, and mid, (tosearch the bottom half) and then calls itself with argumentsA,mid+1, and last (to search the top half). Choose the larger ofthe values returned by these two recursive calls, and return it asyour answer. Your main function should declare an array B of size10, read 10 integers from the input, and return the maximum. Itwill call maxArray(B,0,9), and print the answer. So the user shouldsee the prompt "ten integers:". The user types in ten integers, andthe program returns the maximum. to implement the function intmaxArray(int A[], int first, int last) which returns the largest ofthe numbers A[first]...A[last]. If first=last we have the base case-- return A[first]. If first >last, let mid be (first+last)2.The function calls itself with arguments A,first, and mid, (tosearch the bottom half) and then calls itself with argumentsA,mid+1, and last (to search the top half). Choose the larger ofthe values returned by these two recursive calls, and return it asyour answer. Your main function should declare an array B of size10, read 10 integers from the input, and return the maximum. Itwill call maxArray(B,0,9), and print the answer. So the user shouldsee the prompt "ten integers:". The user types in ten integers, andthe program returns the maximum.Explanation / Answer
please rate - thanks you didn't specify the language, but your previous question wasjava import java.util.*; public class recursivemaxnumber {public static void main(String [] args) {Scanner in=new Scanner(System.in); int n,i=0; int B[]=new int[10]; for (i=0;ibot) returntop; else returnbot; } }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.