Suppose that a stack s and a queue q of characters are initially empty. Show s and q after each iteration of the second for loop of the following code fragment:
for(char ch = 'A'; ch <= 'H'; ch++)
s.Push(ch);
for(int i = 1; i <= 4; i++) {
s.Pop();
q.Enqueue(s.Top());
s.Pop();
q.Enqueue(s.Top());
s.Push(q.Front());
q.Dequeue( );
}
ANSWER: s: A B C E
q: E D D C
Could someone tell me how these answers came about step by step...tried figuring them out but could not.
int x;
int* p= &x
which will decrement x?
*(p--);
(*p)--;
(&p)--;
(*&p)--;
or none of the above?
would this be none of the above?
lastly
what is the value of the expression f(3)?
int Func(int n)
{
if(n==0)
return 0;
else if (n==1)
return 1;
else
return Func (n-1)+Func(n-2);
}
Thx for the help