674 views
0 votes
0 votes
void f (queue Q) {
int i ;
if (!isEmpty(Q)) {
   i = delete(Q);
   f(Q);
   push(s, i);
  }
}
related to an answer for: GATE CSE 1994 | Question: 26

1 Answer

Best answer
4 votes
4 votes
Let size of queue  n and it is full filled.
Then function f(queue Q) will be called n times and every function call having a local variable i. (Untill last function call i.e. queue is empty all i variable should preserved).
So total n function call we need n local variable i.


Additional storage is not constant. It is order of n.
selected by

Related questions

0 votes
0 votes
0 answers
2
pream sagar asked Sep 24, 2018
212 views
L=anbmcndmthere are two conditionCondition 1-if m>n then PDA isCondition 2-if m<n then PDA iscombine Condition 1 and Condition 2then L=anbmcndm is CFL rather then DCF...
3 votes
3 votes
4 answers
3
agoh asked Dec 11, 2016
1,119 views
My doubt is as follows: If deadlock is there, processes will be busy waiting in wait loop. So, decision on which process enters C.S. is not made in finite time. Hence, is...
0 votes
0 votes
1 answer
4
Nilam asked Oct 9, 2015
1,281 views
How can we say r* and r+ may be equal?? Is it correct?