Given that we have a stack with 1.000 items, 2 items are added every second and 5 are removed, how long does it take before the bucket is empty?
In: 2/s
Out: 5/s
Stack size: 1.000
I started out with
1.000 / 5 = 200
But, during those 200 seconds new items enter the bucket:
200 * 2 / 5 = 80 s
There is some repetition involved.
As time is important factor I thought maybe I should look at the different. So the stack is reduced by 3 every second meaning that eventually the stack will be empty.
I thought that time it takes to empty the stack is:
1.000 / 3 = ~333 seconds
Is that correct?