logo

Crowdly

Browser

Додати до Chrome

FIT2004 Algorithms and data structures - S2 2026

Шукаєте відповіді та рішення тестів для FIT2004 Algorithms and data structures - S2 2026? Перегляньте нашу велику колекцію перевірених відповідей для FIT2004 Algorithms and data structures - S2 2026 в learning.monash.edu.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Below is Kruskal's algorithm exactly as it appears in the course notes.

1 function KRUSKAL(G = (V, E))

2 sort(E, key((u, v)) = w(u, v))

3 forest = UnionFind.initialise(n)

4 T = (V, {})

5 for each edge (u, v) in E do

6 if forest.FIND(u) != forest.FIND(v) then

7 forest.UNION(u, v)

8 T.add_edge(u, v)

9 return T

It is run with slow union. Assume the following costs, and that every other line takes constant time:

cost
sorting the edgesΘ(1)
initialising the structure (once)Θ(|V|)
each FINDΘ(1)
each UNIONΘ(|V|)

The edge list is supplied to the algorithm already sorted by weight, so line 2 has nothing left to do; that is why it costs \Theta(1)\Theta(1).

Assume the graph is connected and simple, which implies |V| - 1 \le |E| \le |V|^2|V| - 1 \le |E| \le |V|^2.

Give the worst-case time complexity of the whole algorithm, and explain how you got it. A complete answer states the cost of each part, adds them up, and then says which term dominates and why. No space complexity is needed.

Since you cannot type \Theta()\Theta(), please write theta() in your answer.

Переглянути це питання

A research group has a grant of exactly BB dollars of compute credit, which must be spent down to zero. There are nn machine types. Renting a machine of type ii for one hour costs c_i > 0c_i > 0 dollars and completes j_i > 0j_i > 0 jobs. Any type may be rented any number of times. Maximise the jobs completed.

arraymeaning
c[1..n]dollars to rent a machine of type i for an hour
j[1..n]jobs that hour completes

We solve this by defining the subproblem

maxJobs[x] = the most jobs completable by spending exactly x dollars

For example, with c = [3, 4]c = [3, 4], j = [5, 7]j = [5, 7] and B = 10B = 10, the best is one of each type plus one more of type 1, for 17 jobs.

Write the recurrence relation for this subproblem. Your answer must give:

  • the base case or cases;
  • an infeasible case, because some budgets cannot be met exactly;
  • the general case, including the condition under which it applies;
  • one sentence saying, in words, what the subproblem means.

You do not need to give pseudocode, prove anything, or state a complexity. Write mathematics however is easiest to type; max, <= and -infinity are all fine.

Переглянути це питання

Consider the undirected graph below and Kruskal's algorithm for computing a minimum spanning tree. In which order are the edges added to the solution?

graph

Переглянути це питання

Consider the undirected graph below and Prim's algorithm for computing a minimum spanning tree using node S as the source node. In which order are the edges added to the solution?

graph

Переглянути це питання
A binary search tree holding nn keys, built by inserting the keys so that the tree stays balanced, has height of order:
Переглянути це питання
A code has 88 positions, and each position is filled independently by one of 22 symbols (repetition allowed). How many different codes are possible?
Переглянути це питання
Using the convention that height is the number of edges on the longest root-to-leaf path: a perfect binary tree of height 22 has how many LEAF nodes?
Переглянути це питання
Using the convention that height is the number of edges on the longest root-to-leaf path: how many nodes in total does a perfect binary tree of height 55 contain?
Переглянути це питання

You are running the Kruskal's algorithm to obtain the minimum spanning tree of a connected, undirected, weighted graph with 10 vertices (ID-0 to ID-9). Given the following parent array state of the union-find data structure during the algorithm's run, which of the following statement(s) is true?

0%
0%
Переглянути це питання

You are running the Kruskal's algorithm to obtain the minimum spanning tree of a connected, undirected, weighted graph with 10 vertices (ID-0 to ID-9). Given the following parent array state of the union-find data structure during the algorithm's run, which of the following statement(s) is true?

0%
0%
0%
0%
0%
Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на learning.monash.edu?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome