Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Below are five computational tasks. For each one, choose the data structure o

ID: 3588019 • Letter: 1

Question

1. Below are five computational tasks. For each one, choose the data structure or abstract data type you feel best suited to the task from the following list: Stack, Queue, Hashtable, AVL Tree, Priority Queue, Union-Find. In addition, list the basic operations for the data structure or ADT that you chose and give asymptotic worst-case running times for those operations. No additional explanation is required.

e) Store the activation records (i.e. objects containing the return address and local variable associated with a function call) for nested function calls.

f) What is log2(1; 000; 000; 000) to the nearest whole number?

g) Your friend says she does not like implementing algorithms that have amortized run-time guarantees because amortization makes it harder to debug her code. Why does this argument

make no sense? (A one sentence answer is probably enough.)

Explanation / Answer

e) Stack is best data structure to store activation records. In general the stack operations are Push and Pop where as push is insertion operation and pop is for removal. The asymptotic running time complexity for all stack operations is O(1).

f) 30 is the nearest whole number.

g) because Amortization is only the process to know about analysis of running time. It is no way related to implementation of code for algorithms.