Question: i will upvote if u will solve it quickly b) (12 pts) A sequence of n operations is performed on a data structure. The ith

 i will upvote if u will solve it quickly b) (12

i will upvote if u will solve it quickly

b) (12 pts) A sequence of n operations is performed on a data structure. The ith operation costsiifi is an exact power of 2, and 1 otherwise. Use accounting method to determine the amortized cost per operation. (NO credits, if you use another method) Let = cost of /th operation. ifi is an exact power of 2, CE otherwise - Charge each operation $3 (amortized cost C). Ifi is not an exact power of 2, pay $1, and store $2 as credit. If i is an exact power of 2, pay $i, using stored credit. Operation Cost Actual cost Credit remaining 1 3 2 2 3 2 3 3 3 5 3 4 4 5 3 1 3 8 7 3 1 10 3 8 5 3 1 7 10 3 9 4 6 6 1 8 9 b) (12 pts) A sequence of n operations is performed on a data structure. The ith operation costsiifi is an exact power of 2, and 1 otherwise. Use accounting method to determine the amortized cost per operation. (NO credits, if you use another method) Let = cost of /th operation. ifi is an exact power of 2, CE otherwise - Charge each operation $3 (amortized cost C). Ifi is not an exact power of 2, pay $1, and store $2 as credit. If i is an exact power of 2, pay $i, using stored credit. Operation Cost Actual cost Credit remaining 1 3 2 2 3 2 3 3 3 5 3 4 4 5 3 1 3 8 7 3 1 10 3 8 5 3 1 7 10 3 9 4 6 6 1 8 9

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!