CS 401: Computer Algorithm I
BFS
Xiaorui Sun
1
CS 401: Computer Algorithm I BFS Xiaorui Sun 1 This course - - PowerPoint PPT Presentation
CS 401: Computer Algorithm I BFS Xiaorui Sun 1 This course Grading Scheme Homework ~ 50% ( Five problem sets due on Wed 4pm) Midterm ~ 20% Final ~ 30% Submit through GradeScope
Xiaorui Sun
1
Grading Scheme
2
3
Guidelines:
Spell out main idea.
per late day.
are encouraged to prove the correctness.
.
. edges.
5
6
&' &3 &4 &5 &6
7
8
9
10
11
Queue: 1
12
Queue: 2 3
13
Queue: 3 4
14
Queue: 4 5 6 7
15
Queue: 5 6 7 8 9
16
Queue: 7 8 9 10
17
Queue: 8 9 10 11
18
Queue: 9 10 11 12 13
19
Queue:
21
O(n) times: Check every vertex % O(n) times: At most once per vertex
Overall: O(n2) time
23
O(deg(")) times: At most twice per edge O(n) times: At most once per vertex
Overall: O(n+m) time