Mathematics
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).

answer
Answers: 3

Other questions on the subject: Mathematics

image
Mathematics, 21.06.2019 17:30, rosie20052019
One positive number is 9 more than twice another. if their product is 95, find the numbers
Answers: 1
image
Mathematics, 21.06.2019 19:30, shay03littletop5kx2p
Simplify (1/2)4th power a. (1/16) b.(1/8) c.(1/4)
Answers: 2
image
Mathematics, 21.06.2019 20:10, Jasten
21 type the correct answer in the box. use numerals instead of words. if necessary, use / for the fraction bar. the solution set of n2 - 14n = -45 is { (separate the solutions with a comma)
Answers: 3
image
Mathematics, 21.06.2019 23:20, klrm8045
Point r divides in the ratio 1 : 5. if the coordinates of e and f are (4, 8) and (11, 4), respectively, what are the coordinates of r to two decimal places?
Answers: 3
Do you know the correct answer?
In this problem we consider two stacks a and b manipulated using the following operations (n denotes...

Questions in other subjects:

Konu
Biology, 11.12.2020 01:20
Konu
Health, 11.12.2020 01:20
Konu
History, 11.12.2020 01:20