📗 -> 12/04/24: ECS122A-D10
🎤 Vocab
❗ Unit and Larger Context
Small summary
✒️ -> Scratch Notes
def BF_Drive( ) {
for i=0 to 2^n:
breakpoints = decode(breaks, i)
if is_valid(breakpoints) {
min_cost = cost(breakoints_selected)
best_set = breakpoints
}
return best set
}
O(n)
def is)valid(int[] backpack, int[] h, int c) {
use greedy strategy to check => if this option can read end the return true
=> return false
}
Remember the difference between general and optimal recurrence
- i vs n
Working on ECS122A-HW5
- Adj List
- Adj matrix
- DFS
- BFS
| Vertex | Connections |
|---|---|
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 |
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| 1 | 1 | |||||
| 2 | 1 | 1 | 1 | |||
| 3 | ||||||
| 4 | 1 | 1 | ||||
| 5 | ||||||
| 6 | 3 |
Transclude of ECS122A-HW5-2024-12-04-18.43.17.excalidraw
DFS:
- Stack
BFS: - Queue
🔗 -> Links
Resources
- Put useful links here
Connections
- Link all related words