Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 14 CSE 331 Oct 5, 2009. Extra lectures on proofs Tuesday 5-6pm (Jeff) Wednesday 4:30-6pm (Atri) Commons 9 Prefer my name to Professor/Dr. Rudra.

Similar presentations


Presentation on theme: "Lecture 14 CSE 331 Oct 5, 2009. Extra lectures on proofs Tuesday 5-6pm (Jeff) Wednesday 4:30-6pm (Atri) Commons 9 Prefer my name to Professor/Dr. Rudra."— Presentation transcript:

1 Lecture 14 CSE 331 Oct 5, 2009

2 Extra lectures on proofs Tuesday 5-6pm (Jeff) Wednesday 4:30-6pm (Atri) Commons 9 Prefer my name to Professor/Dr. Rudra

3 Next Week I will be out of town Mon+Wed lecture by Hung Ngo Mid-term Proctored by Hung and couple of Ph.D. students Sample mid-term will be handed out on Friday Jeff’s recitations Flat tire today Scribe needed for Wed

4 A BFS run 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 1 1 2 2 3 3 L0L0 L1L1 4 4 5 5 7 7 8 8 L2L2 6 6 L3L3 L 0 = {s} Assume L 0,..,L j have been constructed L j+1 set of vertices not chosen yet but are connected to L j Stop when new layer is empty

5 A DFS run 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 1 1 2 2 4 4 5 5 6 6 3 3 8 8 7 7 DFS(u) u is explored For every unexplored neighbor v of u DFS(v)

6 Today’s agenda Run-time analysis of BFS (DFS)

7 Stacks and Queues Last in First out First in First out

8 Graph representations Adjacency matrix 0 1 1 1 0 0 1 0 0 Adjacency List (u,v) in E? O(1)O(n) [ O(n v ) ] All neighbors of u? O(n)O(n u ) Space?O(n 2 )O(m+n) Better for sparse graphs and traversals


Download ppt "Lecture 14 CSE 331 Oct 5, 2009. Extra lectures on proofs Tuesday 5-6pm (Jeff) Wednesday 4:30-6pm (Atri) Commons 9 Prefer my name to Professor/Dr. Rudra."

Similar presentations


Ads by Google