4,438 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

7 votes
7 votes
1 answer
1
go_editor asked Jun 17, 2016
4,653 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...
19 votes
19 votes
2 answers
2
go_editor asked Jun 21, 2016
7,161 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 call by value an...
9 votes
9 votes
5 answers
3
go_editor asked Jun 21, 2016
6,131 views
The for loopfor (i=0; i<10; ++i) printf("%d", i&1);prints0101010101011111111100000000001111111111
10 votes
10 votes
4 answers
4
go_editor asked Jun 21, 2016
9,383 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 ...