Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: + 2 + 2 + 3 = 9, while you only give a sum of 2 + 2 + 2 + 2 = 8 amortized costs. 4) If you write down aggregation method but then you perform other methods following your “aggregation method: ” notation, for example, you write immediately that “guess the amortized cost of add is …”, or “define a potential function as …”, etc, then you will be deducted by 1 point from what your other method deserves to earn. 5) If you don’t write anything, you get 0 out of 6 points. 6) If you indeed use the aggregation method and give the correct answer, then congratulations! You get full marks for this method (6 out of 6 points). b) Accounting method: Guess amortized cost is 4, each add will use 2 and we still have 2 credits for each element in the list for deleteOdd (we only use the 2 credits of odd elements in case of deleteOdd: one for the odd element itself and one for the element following it). Since each node can only be deleted once, 4 is enough. (If there is add among deleteOdds, the situation will be no worse if we have amortized cost of 4 because each...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online