757 views
0 votes
0 votes

Let S be a stack of size n >= 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 one such stack operation and the start of the next operation. For m >= 1, define the stack-life of m as the time elapsed from the end of 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

A

n(X+ Y)

B

3Y + 2X

C

n(X + Y)-X

D

Y + 2X

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
1
Abhrajyoti00 asked Oct 29, 2022
741 views
Can there be “Stack Overflow” in Linked list Implementation of stack? If Yes, how?