Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 17 CSE 331 Oct 8, 2010. HW 4 due today Q1 and Q2 in one pile Q3 in another pile I will not take any HW after 1:15pm.

Similar presentations


Presentation on theme: "Lecture 17 CSE 331 Oct 8, 2010. HW 4 due today Q1 and Q2 in one pile Q3 in another pile I will not take any HW after 1:15pm."— Presentation transcript:

1 Lecture 17 CSE 331 Oct 8, 2010

2 HW 4 due today Q1 and Q2 in one pile Q3 in another pile I will not take any HW after 1:15pm

3 Solutions to HW 4+ graded HW 3 At the end of the lecture

4 HW 5 Has been posted

5 Sample mid term Has been posted: a blog post soon Don’t read too much into the content

6 On Friday, Oct 15 hours-a-thon Atri: 2:00-3:30 (Bell 123) Jeff: 3:30-5:00 (Commons 9) Alex: 5:00-6:30 (Bell 224)

7 A theory workshop this weekend http://www.cse.buffalo.edu/events/theory-III/

8 DFS(u) u is explored For every unexplored neighbor v of u DFS(v) 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 Every non- tree edge is between a node and its ancestor DFS tree

9 HW 4 due today Q1 and Q2 in one pile Q3 in another pile I will not take any HW after 1:15pm

10 Questions?

11 Connected components are disjoint Either Connected components of s and t are the same or are disjoint Algorithm to compute ALL the connected components? Run BFS on some node s. Then run BFS on t that is not connected to s

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

13 Stacks and Queues Last in First out First in First out

14 But first… How do we represent graphs?

15 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

16 m ≤ n(n-1)/2: why?


Download ppt "Lecture 17 CSE 331 Oct 8, 2010. HW 4 due today Q1 and Q2 in one pile Q3 in another pile I will not take any HW after 1:15pm."

Similar presentations


Ads by Google