subject
Mathematics, 31.07.2019 19:30 haleydanielle8

In this problem we consider two stacks a and b manipulated using the following operations (n denotes the size of a and m the size of b):
• pusha(x): push element x on stack a.
• pushb(x): push element x on stack b.
• multipopa(k): pop min{k, n} elements from a.
• multipopb(k): pop min{k, m} elements from b.
• transfer(k): repeatedly pop an element from a and push it on b, until either k elements have been moved or a is empty.
assume that a and b are implemented using doubly-linked lists such that pusha and pushb, as well as a single pop from a or b, can be performed in o(1) time worst-case.
(a) what is the worst-case running time of the operations multipopa, multipopb and transfer?
(b) define a potential function φ(n, m) and use it to prove that the operations have amortized running time o(1).

ansver
Answers: 3

Another question on Mathematics

question
Mathematics, 21.06.2019 23:50
What is the scale factor of two similar pyramids with volumes of 64 cubic feet and 8 cubic feet
Answers: 1
question
Mathematics, 22.06.2019 04:00
How many four digit even numbers can be formed from digits 1,2,3,4,5 if repetition is allowed. how can solve this using permutation formula
Answers: 1
question
Mathematics, 22.06.2019 04:00
Which function has an inverse that is also a function? a. g(x) = 2x-3 b. k(x) = -9x2 c. f(x) |x+2| d. w(x) = -20
Answers: 1
question
Mathematics, 22.06.2019 04:30
7x^2-9x+5=0 find the discriminant and number of real solutions
Answers: 1
You know the right answer?
In this problem we consider two stacks a and b manipulated using the following operations (n denotes...
Questions
question
Mathematics, 24.05.2021 23:10
question
History, 24.05.2021 23:10
question
Mathematics, 24.05.2021 23:10
question
English, 24.05.2021 23:10
question
English, 24.05.2021 23:10
question
Mathematics, 24.05.2021 23:10
question
Mathematics, 24.05.2021 23:10
Questions on the website: 13722360