This preview shows page 1. Sign up to view the full content.
Unformatted text preview: added nodes will have its own credits with it for deletion.) Grading criteria: 1) If you indeed use the accounting method, but give 3 as your answer of amortized cost, you will get 2 out of 6 points since the answer is incorrect. Think about a scenario as follows: you insert (n‐2) elements, and then perform deleteOdds twice. The actual cost of these n operations will be 2(n‐2) + (n‐2) + (n‐2) /2 = 7(n‐2)/2, which amortized to about 7/2 for each operation. Here, 3 is definitely not enough. In this scenario, I give you 1 extra point (so 3 out of 6 points) if you write down correctly that you use 2 of the 3 credits for each ADD and keep within the new added element 1 credit for deleteOdds. 2) If you indeed use the accounting method, but separate the two operations and give 2 as the amortized cost for ADD and n as the amortized cost for DeleteOdds, you will get 3 out of 6 points since the question asks “What is the smallest integer amortized cost for the Add() and DeleteOdds() operations?” The question intends you to give the same amortized cost for the two operations. Also n is NOT the smallest integer amortized cost for DeleteOdds. I give you 3 points (1 point more than...
View Full Document
This note was uploaded on 11/17/2012 for the course COP 5536 taught by Professor Staff during the Spring '08 term at University of Florida.
- Spring '08