edited by
331 views
1 votes
1 votes
consider following recursive code:

algorithm xyz(t,S)

{

k=S.size();

while(!S.isempty())

{   S.pop();

t++;

//S:a new stack of size k-1

xyz(t,S);

 

}

}

starting with the call xyz(0,S),where S is a stack of n element(1,2,3,4......),

[ doubt is after first fun call xyz(0,S) when we cheak while loop,after t++ should execute once again xyz function or cheak while loop??]

how this code will work?? detail explaination??
edited by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
1
Abhrajyoti00 asked Oct 29, 2022
746 views
Can there be “Stack Overflow” in Linked list Implementation of stack? If Yes, how?