Question: Consider the problem of finding the position, p, of the last occurrence of a given number, x, in an array, A. We thus want a function FindLast(A,n,x) with precondition: x occurs in A[1::n] (thus n >= 1) and with postcondition: returns p with 1 <= p <= n such that A[p] = x and x does not occur in A[p + 1::n].
Q: Design a recursive algorithm to implement this specification. That is, the body of FindLast should contain a recursive call FindLast(A,..,..).
Can you give the answer ASAP and there is no word limit?