ISRO Computer Science (CSE) 2015 - Question 15

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2015

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

  • A. It cannot be implemented
  • B. 2 stacks
  • C. 4 stacks
  • D. 1 stack

Answer: B. 2 stacks

Explanation: A queue can be implemented using two stacks (s1 for enqueue, s2 for dequeue).

| | All questions of ISRO Computer Science (CSE) 2015