logo

Crowdly

Browser

Add to Chrome

FIT2004 Algorithms and data structures - S1 2025

Looking for FIT2004 Algorithms and data structures - S1 2025 test answers and solutions? Browse our comprehensive collection of verified answers for FIT2004 Algorithms and data structures - S1 2025 at learning.monash.edu.

Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!

For a sequence of n integers in range [-2 … n-2], and considering worst-case time complexity, which sorting algorithm(s) can be optimally implemented to guarantee a linear time to sort this sequence? 

0%
0%
✅
0%
View this question

Solve, in big-θ, the following recurrence relation

T(n) = 4 * T(n/4) + c, where n >= 4

T(n) = b, where n = 1

for constants b and c.
❌
0%
0%
0%
0%
0%
0%
❌
View this question

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?  

0%
0%
0%
0%
View this question

What is the auxiliary space of least significant digit (LSD) radix sort for an array of n integers? 

0%
0%
0%
0%
View this question

Consider the following Python code that returns true if and only if the string s is a palindrome. A string is a palindrome if it is the same when reversed, e.g., "madam" is a palindrome whereas "algorithm" is not. 

def is_palindrome(s):

      left = 1

      right = len(s)

      while left < right:

            # loop invariant

            if s[left] != s[right]:

                  return False

            left += 1

            right -= 1

      return True

What is an appropriate loop invariant for this algorithm at the point specified?

✅
❌
❌
❌
View this question

Which of those sorting algorithms has time complexity that is independent from the array contents (assuming that it is an array of integers)?

0%
100%
100%
100%
View this question

Consider the following algorithm, which returns the index of the maximum value in an array of integers.

The function accepts a list A[1…n] with n items

myfunc(A, n):

    i = 1

    j = n

    while (i < j):

        if (A[i] > A[j]):

            j = j – 1

        else:

            i = i + 1

### Loop Invariant ###

    return i

What is an appropriate loop invariant for this algorithm at the point specified?

0%
0%
0%
0%
0%
View this question

Consider the following algorithm, which accepts a list A[1…n] with n items and performs a set of operations:

myfunc(A, n):

    i = 1

    while (i < n):

### Loop Invariant ###

        if (A[i] > A[i+1]):

            temp = A[i]

A[i] = A[i+1]

A[i+1] = temp

        i = i + 1

    return A[n]

What is an appropriate loop invariant for this algorithm at the point specified?

0%
0%
0%
0%
0%
0%
View this question

Solve, in big-θ, the following recurrence relation

T(n) = 2 * T(n/2), where n > 1

T(n) = c, where n = 1

for a constant c.

0%
0%
0%
0%
0%
0%
0%
0%
View this question

Given the following pseudocode, derive the recurrence relation that represents its time complexity. 

def power(x, n):

if n == 0:

return 1

return x * power(x, n - 1)

Let b and c represent constant values. What is the base case and recurrence step?  

0%
100%
0%
View this question

Want instant access to all verified answers on learning.monash.edu?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome