GATE CS 2003 · Arrays & Matrix Representation

MCQ · 1 mark · Problem PROG-DSTR-0243

Let S be a stack of size n \(\geq\) 1. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform n pop operations. Assume that Push and Pop operation take X seconds each , and Y seconds elapse between the end of the one such stack operation and the start of the next operation. For m \(\geq\) 1, define the stack-life of m as the time elapsed from the end or Push (m) to the start of the pop operation that removes m from S . The average stack-life of an element of this stack is
  1. A
    n(X+Y)
  2. B
    3Y+2X
  3. C
    n(X+Y)-X
  4. D
    Y+2X

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: Option C.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/951/gate2003-64

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com