Stack life

Computer Science Level 3

Let \(S\) be a stack of size greater than \(1\). Starting from an empty stack, suppose we push the first \(n\) natural numbers in sequence and then perform \(n\) pop operations. For \(1\leq x\leq n\) the stack life of \(x\) is defined as the time taken from the end of push(x) to the start of the pop operation that removes \(x\) from \(S\). What of the following is the correct representation for the average stack life of \(x\)?

Details and Assumptions

  • \(k\) is the number of seconds required to pop and push an item
  • \(l\) is the number of seconds elapsed between each successive operations.

Problem Loading...

Note Loading...

Set Loading...