Looking for FIT2004 Algorithms and data structures - S1 2026 test answers and solutions? Browse our comprehensive collection of verified answers for FIT2004 Algorithms and data structures - S1 2026 at learning.monash.edu.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Consider the following AVL tree.
Initial directed AVL tree
A directed AVL tree with root 44. Edges point from each parent to its child.
44
31
67
18
36
53
81
13
24
59
The following operations are then performed in order:
Assume that inserting a key already present in the tree leaves the tree unchanged. After each successful insertion or deletion, standard AVL rebalancing is performed.
Tick all keys whose node balance factor is +1 in the resulting AVL tree, i.e. the height of the left subtree is greater than the height of the right subtree.
Consider the following directed left-leaning red-black tree. Edges point from each parent to its child.
The following operations are then performed in order:
Assume that inserting a key already present in the tree leaves the tree unchanged.
Tick all keys that are at red nodes in the resulting tree.
Find a closed-form solution for the following recurrence relation:
T(n) = \begin{cases} 2T(n-2)+a, & \text{if } n > 0,\\ b, & \text{if } n = 0, \end{cases}
where a and
b are positive constants. Assume
n is even. You may optionally provide working & verification, although please clearly state your closed form at the bottom of the response.
Consider the following algorithm. Assume the input array contains numbers.
|
|
For any value of k between 2 and
n,
sum is equal to the sum of elements of array[1..k-1].
You will need to show:
You do not need the termination step.
You find yourself curiously stranded on a n by n mysterious grid (shown below), unsure of how you got there, or how to leave. You denote the rows of the grid from bottom to top as 1, 2, ..., n, and similarly denote the columns from left to right as 1, 2, ..., n. Cell (i, j) refers to row i, column j.
You are currently standing at the bottom-left corner of the grid and wonder to yourself how many different ways there are to walk to the top-right corner of the grid. However, there are certain conditions on the grid's cells.
In the normal cells of the grid (cells with white background below), you feel fatigued and are only able to move to the cell to the immediate right (to the next column). In the special cells of the grid (cells with blue background below), you feel more energised and are able to move either to the cell that is immediately up (to the next row) or immediately right (to the next column).
Which of the following options describe correct dynamic programming recurrences for those cells? Select all correct options.
You find yourself curiously stranded on a n by n mysterious grid (shown below), unsure of how you got there, or how to leave. You denote the rows of the grid from bottom to top as 1, 2, ..., n, and similarly denote the columns from left to right as 1, 2, ..., n. Cell (i, j) refers to row i, column j.
You are currently standing at the bottom-left corner of the grid and wonder to yourself how many different ways there are to walk to the top-right corner of the grid. However, there are certain conditions on the grid's cells.
In the normal cells of the grid (cells with white background below), you feel fatigued and are only able to move to the cell to the immediate right (to the next column). In the special cells of the grid (cells with blue background below), you feel more energised and are able to move either to the cell that is immediately up (to the next row) or immediately right (to the next column).
Which of the following options describe correct dynamic programming recurrences for those cells? Select all correct options.
You find yourself curiously stranded on a n by n mysterious grid (shown below), unsure of how you got there, or how to leave. You denote the rows of the grid from bottom to top as 1, 2, ..., n, and similarly denote the columns from left to right as 1, 2, ..., n. Cell (i, j) refers to row i, column j.
You are currently standing at the bottom-left corner of the grid and wonder to yourself how many different ways there are to walk to the top-right corner of the grid. However, there are certain conditions on the grid's cells.
In the normal cells of the grid (cells with white background below), you feel fatigued and are only able to move to the cell to the immediate right (to the next column). In the special cells of the grid (cells with blue background below), you feel more energised and are able to move either to the cell that is immediately up (to the next row) or immediately right (to the next column).
Which of the following options describe correct dynamic programming recurrences for those cells? Select all correct options.
You find yourself curiously stranded on a n by n mysterious grid (shown below), unsure of how you got there, or how to leave. You denote the rows of the grid from bottom to top as 1, 2, ..., n, and similarly denote the columns from left to right as 1, 2, ..., n. Cell (i, j) refers to row i, column j.
You are currently standing at the bottom-left corner of the grid and wonder to yourself how many different ways there are to walk to the top-right corner of the grid. However, there are certain conditions on the grid's cells.
In the normal cells of the grid (cells with white background below), you feel fatigued and are only able to move to the cell to the immediate right (to the next column). In the special cells of the grid (cells with blue background below), you feel more energised and are able to move either to the cell that is immediately up (to the next row) or immediately right (to the next column).
Which of the following options describe correct dynamic programming recurrences for those cells? Select all correct options.
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?
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?