Asymptotic Analysis & Recurrences

Answer & solution
Answer: 3 (no official key was published)
Step through it (23 steps)
The base case with B=0 represents the single way to choose no elements. The A<B case represents the impossibility of choosing more elements than are available. The recursive case separates choices according to whether the last element is excluded or included; it is Pascal’s binomial recurrence.
Expand the requested call rather than assuming a closed form: GET(3,2)=GET(2,2)+GET(2,1). The first term is GET(1,2)+GET(1,1)=0+[GET(0,1)+GET(0,0)]=0+0+1=1. The second is GET(1,1)+GET(1,0)=1+1=2. Hence the result is 3, agreeing with the binomial coefficient C(3,2). The ordering of the tests matters at (0,0): B=0 is tested first and returns 1.