Runtime of Floyd-Warshall?
Note 1: ETH::1. Semester::A&D
Deck: ETH::1. Semester::A&D
Note Type: Algorithms
GUID:
modified
Note Type: Algorithms
GUID:
hL7UB-)y6N
Before
Front
Back
Runtime of Floyd-Warshall?
\(O(|V|^3)\)
After
Front
Runtime of Floyd-Warshall?
Back
Runtime of Floyd-Warshall?
\(O(|V|^3)\)
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Approach | <ol><li><b>Initialise</b>: distance matrix D D[i][j] is the weight of the edge from \(i \rightarrow j\) if it exists, \(\infty\) otherwise<br></li><li><b>Iterate over intermediate</b>: for each vertex \(k\) update D[i][j] = min(D[i][j], D[i][k] + D[k][j]). for all intermediate k from 1,...,n</li></ol><div><br></div><div>The final distance matrix D contains the shortest path from any i to j.</div><div><br></div><div><i>Note that this can also be done using a 3d DP table, the 2d is just optimised.</i><br></div> | <ol><li><b>Initialise</b>: distance matrix D D[i][j] is the weight of the edge from \(i \rightarrow j\) if it exists, \(\infty\) otherwise<br></li><li><b>Iterate over intermediate</b>: for each vertex \(k\) update D[i][j] = min(D[i][j], D[i][k] + D[k][j]). for all intermediate k from 1, ..., n</li></ol><div><br></div><div>The final distance matrix D contains the shortest path from any i to j.</div><div><br></div><div><i>Note that this can also be done using a 3d DP table, the 2d is just optimised.</i><br></div> |
Note 2: ETH::1. Semester::A&D
Deck: ETH::1. Semester::A&D
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
oWyDyQ_9bL
Before
Front
After adding \(x\) edges to the Union-Find DS, the repr array contains \(n-x\) components (different values).
Back
After adding \(x\) edges to the Union-Find DS, the repr array contains \(n-x\) components (different values).
Each added edge removes one unconnected component.
After
Front
After adding \(x\) edges to the Union-Find datastructure, the repr array contains \(n-x\) components (different values).
Back
After adding \(x\) edges to the Union-Find datastructure, the repr array contains \(n-x\) components (different values).
Each added edge removes one unconnected component.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | After adding \(x\) edges to the Union-Find |
After adding \(x\) edges to the Union-Find datastructure, the <b>repr</b> array contains {{c1::\(n-x\) components (different values)}}. |
Note 3: ETH::1. Semester::EProg
Deck: ETH::1. Semester::EProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
DL*jz,QL[w
Before
Front
WP { }
PC {false}
the WP is false
PC {false}
the WP is false
Back
WP { }
PC {false}
the WP is false
PC {false}
the WP is false
As only false implies false.
After
Front
The weakest precondition for an empty program with postcondition false is false.
Back
The weakest precondition for an empty program with postcondition false is false.
As only false implies false.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | The weakest precondition for an empty program with postcondition false is {{c1::false}}. |
Note 4: ETH::1. Semester::EProg
Deck: ETH::1. Semester::EProg
Note Type: Horvath Cloze
GUID:
modified
Note Type: Horvath Cloze
GUID:
E_A@gwOm;?
Before
Front
Arrays has helper methods that make simple operations quicker:
- Arrays.equals(a, b) to compare arrays
- Arrays.copyOf(arr, l) that returns a new copied array of length l
- Sorting useing Arrays.sort(arr)
- toString() and deepToString()
Back
Arrays has helper methods that make simple operations quicker:
- Arrays.equals(a, b) to compare arrays
- Arrays.copyOf(arr, l) that returns a new copied array of length l
- Sorting useing Arrays.sort(arr)
- toString() and deepToString()
After
Front
The Arrays class has helper methods that make simple operations quicker:
- Arrays.equals(a, b) to compare arrays
- Arrays.copyOf(arr, l) that returns a new copied array of length l
- Sorting using Arrays.sort(arr)
- toString() and deepToString()
Back
The Arrays class has helper methods that make simple operations quicker:
- Arrays.equals(a, b) to compare arrays
- Arrays.copyOf(arr, l) that returns a new copied array of length l
- Sorting using Arrays.sort(arr)
- toString() and deepToString()
Arrays.deepToString() converts a nested/multidimensional array to a readable string representation, recursively handling inner arrays.
Field-by-field Comparison
| Field | Before | After |
|---|---|---|
| Text | Arrays has helper methods that make simple operations quicker:<br><ul><li>{{c1:: |
The Arrays class has helper methods that make simple operations quicker:<br><ul><li>{{c1::<b>Arrays.equals(a, b)</b> to compare arrays::Compare}}<br></li><li>{{c2::<b>Arrays.copyOf(arr, l)</b> that returns a new copied array of length l::Transfer values}}</li><li>{{c3::Sorting using <b>Arrays.sort(arr)::Order</b>}}</li><li>{{c4::<b>toString()</b> and <b>deepToString()</b>::Print}}</li></ul> |
| Extra | Arrays.deepToString() converts a nested/multidimensional array to a readable string representation, recursively handling inner arrays. |