edited by
455 views
1 votes
1 votes

Can someone explain the solution along with a picture of how the steps are taking place? 

edited by

1 Answer

2 votes
2 votes
initially, p _ _ q r ;

where front pointer point to q and rear pointer point to p;

1. enqueue 'a'    -->    p a _ q r

2. dequeue        -->    p a _ _ r

3. enqueue 'b'    -->    p a b _ r

4. dequeue        -->    p a b  _ _

5. enqueue 'c'    -->    p a b c _  

6. dequeue        -->    _ a  b c _

Related questions

2 votes
2 votes
1 answer
1
0 votes
0 votes
1 answer
2
manvi_agarwal asked Jul 29, 2018
320 views
https://gateoverflow.in/?qa=blob&qa_blobid=10936115150698131975