Looking for FIT1008-FIT1054-FIT2085 Fundamentals of algorithms - S2 2025 test answers and solutions? Browse our comprehensive collection of verified answers for FIT1008-FIT1054-FIT2085 Fundamentals of algorithms - S2 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!
Complete the python method that implements the push method for a Linked Stack class. [4 marks]
Perfect python syntax is not required.
Provide one advantage/disadvantage of a Linked Stack over an Array-Based Stack. [1 mark]
class Node:
def __init__(self, item):
self.item = item
self.link = None
class LinkedStack(Stack):
def __init__(self):
self.top = None
self.length = 0
def push(self, item):
pass
Which is TRUE?
What does the following function do if n >= 0?
def mystery(n):
i = 0
yield i
while i < n:
if i % 4 != 0:
yield i
i = i + 2
What are the main operations on a Priority Queue?
I have decided to use a balanced Binary Search Tree (BST) to implement Separate Chaining in a Hash Table. What is the complexity of updating an item in such a hash table?
O(hash) - complexity of the hash functionn - the largest number of items in a bucketm - the number of slots in the hash table
I want to generate a balanced BST from a list with numbers from 1 to 10 (in ascending order) inclusive and apply no self-balancing. To do that, what order should I insert items in?
What is the time complexity of the following function if measured with respect to n?
def mystery(n: int) -> int:
count = 0
for i in range(n):
count += 1
if n == 0:
return count
else:
return mystery(n - 1)
We are given an integer A that represents a bit-vector set containing N elements (N is an even number, greater than 0, and we know its value).
How can we break up A into two smaller numbers X and Y, representing two other bit-vector sets, so that each contains exactly half of the N elements?
A doesn't need to remain intact after the operations.
Explain your approach and its best and worst case time complexities. You must define your input variables and provide an explanation as part of your complexity analysis.
What is the best-case and worst-case time complexities of adding an item to a Stack implemented with an array and meant to allow resizing?
Define any input variables (no explanation, no marks).
Describe the Stack ADT giving details about:
The main property of the stack
The two main operations of the stack