4,604 views
9 votes
9 votes

The queue data structure is to be realized by using stack. The number of stacks needed would be

  1. It cannot be implemented
  2. 2 stacks
  3. 4 stacks
  4. 1 stack

2 Answers

Best answer
9 votes
9 votes

The correct option is B.

selected by
Answer:

Related questions

4.8k
views
1 answers
7 votes
go_editor asked Jun 17, 2016
4,763 views
If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop are performed on a stack, the sequence of popped out values2,2,1,1,22,2,1,2,22,1,2,2,12,1,2,2,2
7.4k
views
2 answers
19 votes
go_editor asked Jun 21, 2016
7,379 views
Consider the following code fragmentvoid foo(int x, int y) { x+=y; y+=x; } main() { int x=5.5; foo(x,x); }What is the final value of $\textsf{x}$ in both ... $ and $16$5$ and $12$5$ and $20$12$ and $20$
6.4k
views
5 answers
9 votes
go_editor asked Jun 21, 2016
6,440 views
The for loopfor (i=0; i<10; ++i) printf("%d", i&1);prints0101010101011111111100000000001111111111
9.8k
views
4 answers
10 votes
go_editor asked Jun 21, 2016
9,847 views
The output of the following program ismain() { static int x[] = {1,2,3,4,5,6,7,8} int i; for (i=2; i<6; ++i) x[x[i]]=x[i]; for (i=0; i<8; ++i) printf("%d", x[i]); }1 2 3 3 5 5 7 81 2 3 4 5 6 7 88 7 6 5 4 3 2 11 2 3 5 4 6 7 8