logo

Crowdly

FIT1008-FIT2085 Fundamentals of algorithms - S1 2025

Looking for FIT1008-FIT2085 Fundamentals of algorithms - S1 2025 test answers and solutions? Browse our comprehensive collection of verified answers for FIT1008-FIT2085 Fundamentals of algorithms - 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!

What is the worst-case time complexity of the following function assuming it is measured on value n rather than its logarithmic size?

from array_sorted_list import ArraySortedList

from sorted_list_adt import ListItem

def mystery(n: int) -> None:

my_list = ArraySortedList(10)

for i in range(10):

my_list.add(ListItem(n, i)) # assume ListItem(n, i) is O(1)

# ListItem(value, key) adds based on key

for i in range(9, -1, -1):

my_list.delete(ListItem(n, i))

View this question

I have an array-based sorted list implemented with n elements. I want to delete a target element. What is the worst-case time complexity of this?

 

View this question

What are the issues with the following implementation of delete item on an unsorted linked list? You can assume self.head points to the node at the beginning of the list and each node has a link variable that refers to the next node in the list (or None if it's the last node).

def __delitem__(self, key) -> None:

if self.is_empty():

raise ValueError("Can't delete from an empty list")

previous = None

current = self.head

for _ in range(len(self)):

if current.item == key:

current = previous.link

else:

previous = current

current = current.link

View this question

I have an unsorted linked list and I am implementing an insert() method. Where would the item be inserted for the worst-case complexity?

View this question

What is the worst-case time complexity of the following function assuming it is measured on value n rather than its logarithmic size?

from array_sorted_list import ArraySortedList

from sorted_list_adt import ListItem

def mystery(n: int) -> None:

my_list = ArraySortedList(n)

for i in range(n):

my_list.add(ListItem(n, i)) # assume ListItem(n, i) is O(1)

# ListItem(value, key) adds based on key

View this question

I have a sorted list implemented using linked nodes. I want to find a target element, which algorithm can I effectively use?

View this question

What is the worst-time complexity of the following function if the input list is of size n?

def mystery(my_list: ArrayList) -> None:

my_queue = Queue(len(my_list))

for item in my_list:

my_queue.append(item)

while not my_queue.is_empty():

print(my_queue.serve())

View this question

Given an array-based Stack of size

n, what is the complexity of push()?

View this question

What does the following code do?

def mystery(a_list: List) -> List:

my_stack = Stack(len(a_list))

my_list = List(len(a_list))

for item in a_list:

my_stack.push(item)

while not my_stack.is_empty():

my_list.append(my_stack.pop())

return my_list

View this question

I'm implementing a new web browser, and want to keep track of the history of pages I've visited so that I can implement the back button on the web browser. What would be most appropriate ADT for this history?

0%
100%
0%
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!