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!

I want to add a new method to the Linked Stack class to combine the current stack self with another stack other provided as an argument. You may see this as an in-place update of stack self. What would be the worst-case time complexity of this operation assuming that

n is the length of self and

m is the length of other?

For example, if I had the following stacks:

self: 1 -> 2 -> 3 -> 4 -> 5 [1 is the top element]

other: 6 -> 7 -> 8 -> 9 -> 10 [6 is the top element]

The result should be:

self: 6 -> 7 -> 8 -> 9 -> 10 -> 1 -> 2 -> 3 -> 4 -> 5 [6 is the top element]

0%
0%
100%
0%
View this question

I wish to make a container class to be iterable. Which of the following statements are true?

0%
0%
0%
100%
View this question

The main operations of the Queue ADT are append() and serve(). We wish to implement the queue using linked nodes. What are the time complexities of these methods? We can assume

n is referring to the number of elements currently in the queue.

0%
0%
100%
0%
View this question

I have a List class and I wish to create an Iterator for it. What are the benefits of putting the Iterator in a separate class?

100%
100%
0%
View this question

What is TRUE about a Python Generator?

33%
100%
0%
0%
View this question

If we were to compare the main operations of the Linked Stack and Linked Queue which one is more efficient in terms of time complexity of their operations?

0%
0%
0%
100%
View this question

I want to add a new method to the Linked Queue class to combine two queues of length

n and

m together in a new queue and return this new queue. The new queue should contain all elements of the first queue followed by all the elements of the second queue. Thus, the relative order of elements in the input queues and the result queue must be the same after this operation has been completed. What would be the worst-time complexity of this operation?

For example, if I had the following queues:

queue1: 1 -> 2 -> 3 -> 4 -> 5 [1 is the front of the queue]

queue2: 6 -> 7 -> 8 -> 9 -> 10 [6 is the front of the queue]

The resulting queue should be

queue3: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> 10 [1 is the front of the queue]

Note: queue 1 and queue 2 should maintain their original items.

0%
0%
0%
100%
View this question

If I was to loop over this Iterator, how many times would it iterate?

class NumberIterator:

    def __init__(self):

        self.current = 1

        

    def __iter__(self):

        return self

        

    def __next__(self):

        if self.current == 10:

            raise StopIteration()

        

        next_item = self.current

        self.current += 2

        return next_item
0%
0%
0%
100%
View this question

What is TRUE about a Python Generator?

0%
100%
100%
50%
View this question
The main operations of the Stack ADT are push() and pop(). We wish to implement the stack using linked nodes. What are the worst-case time complexities of these methods? We can assume 

n is referring to the number of elements currently in the stack.
0%
0%
0%
100%
View this question

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

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