It looks to me like temp
is a variable.
It's making a recursive call to your funciton: MAXB
and storing the value from that call in a variable called temp
.
It's then checking whether or not temp
is greater than or equal to A[r]
, and if it is, than it returns temp
. If it is less than A[r]
it returns A[r]
__________________________________________________________
Here's an explanation of the entire function:
if p=r
then return A[p]
if p
and r
are equal, than there is only one value between A[p]
and A[r]
, and therefore, that one values is the greatest and you return that value.
else
temp<-----MAXB(A,p,r-1)
You use your own function, MAXB
to get the greatest value between A[p]
and A[r-1]
, and you store that in temp
if temp>=A[r]
then return temp
else
return A[r]
you compare to greatest value between A[p]
and A[r-1]
to A[r]
. Whichever one is greater, must be the greatest value between A[p]
and A[r]
, and is therefore the value that you want to return.