Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago