what is happening to the queue contents

Write your question here.

1
2
3
4
5
6
7
8
9
10
  What does the following function do on the Queue contents?
void func()
{
if(Q not empty)
{
int temp=dequeue();
func();
enqueue(temp*temp);
}
}
it will replace all the contents of the queue with their corresponding square values in their respective positions
It will also reverse queue.

Or it would not compile at all as (Q not empty) is not legal in any context.
Last edited on
thanks a lot !
Topic archived. No new replies allowed.