Let $P$ be a procedure that for some inputs calls itself (i.e. is recursive). If $P$ is guaranteed to terminate, which of the following statement(s) must be true?
It is said that the recursive procedure p will terminate ultimately.If p don't have any parameter or don't refer to any global variable then p will consist of only local variables.So each time when p will recursively be called then a new copy of local variables will be created in the stack.In this case we can't track howmany times p is called till now.So p have to refer atleast one global variable or take atleast one parameter.
Along with that we have to use the global variable or the parameter by imposing a condition that when p will not call itself.At that time only p will terminate.
64.3k questions
77.9k answers
244k comments
80.0k users