Looking for FIT2004 Algorithms and data structures - S1 2026 test answers and solutions? Browse our comprehensive collection of verified answers for FIT2004 Algorithms and data structures - S1 2026 at learning.monash.edu.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Pierre's microwave has keys to input reheating time, with possible positive times described by the set K. For instance, we could have
K=\{1,10,60\}.
Pierre is wondering what the minimum number of keys to press to input the time t. Each key can be pressed multiple times.
For example, the minimum number of keys to press for a time t=25 is
7: pressing
10 twice and pressing
1 five times.
In order to solve this problem, we decompose the problem into subproblems defined as
minPresses[t]= {the minimum number of key presses required to input a time t using keys from
K}.
Give a recurrence relation for minPresses by giving all cases in the expression
minPresses[t] = \begin{cases} \text{first case}\\ \dots\\ \text{last case}, \end{cases}
(Recall that a recurrence relation needs at least one base case and one general case.)
Solve, in big-θ, the following recurrence relation
T(n) = 4 * T(n/4), where n >= 4
T(n) = c, where n = 1
for a constant c.
Given the following pseudocode, derive the recurrence relation that represents its time complexity.
def fibonacci(n):
if (n==0 or n==1):
return n
return fibonacci(n - 1) + fibonacci(n - 2)
Let b and c represent constant values. What is the base case and recurrence step?